1

I'm trying to compress a buffer, and it works fine on my local machine, but when I upload the service to Cloud Foundry on IBM Cloud, it doesn't work (no errors in logs). Sample code is here:

const {gzip} = require('node-gzip')

gzip(buf)
.then((compressed) => {
  logger.debug('buffer has been compressed')
})

Here is package.json:

  "dependencies": {
    "bluemix-autoscaling-agent": "1.0.14",
    "cfenv": "1.1.0",
    "cors": "2.8.5",
    "express": "4.16.4",
    "lodash": "4.17.11",
    "node-gzip": "1.1.2",
    "object-path": "0.11.4",
    "path": "0.12.7"
  }

Cloud Foundry service LOG_LEVEL=debug so I can see logs output for other part of my code. Do you know any other alternative to node-gzip to compress/decompress a buffer? ZLIB is too old - last updated 7 years ago. We don't want to use it as a matter of code integrity and security.

data_henrik
  • 16,724
  • 2
  • 28
  • 49
VladP
  • 881
  • 2
  • 13
  • 37
  • "Bluemix" as in Cloud Foundry? – data_henrik Feb 12 '19 at 21:23
  • yes, this is Cloud Foundry – VladP Feb 12 '19 at 21:24
  • add the output you are seeing, also the package.json and the manifest.yml files – data_henrik Feb 12 '19 at 21:28
  • I've added dependencies list.. The problem is that I don't see any output in logs or code execution that is within .(then((compressed)=>{}) – VladP Feb 12 '19 at 21:33
  • What type of program is it? Is it even started? When you are pushing the code, does the app start without errors? – data_henrik Feb 12 '19 at 21:48
  • it's Node.js service.. it starts fine.. But what I found node-gzip still uses ZLIB. So is there any other useful method to compress/decompress Buffer in Node.js? – VladP Feb 12 '19 at 22:54
  • Another alternative would be to package the CF app in a Docker container to avoid having missing libraries in the buildpack: https://github.com/IBM-Cloud/logistics-wizard/blob/master/Deploy_Microservices_Cloud_Foundry_Docker.md – Rene Meyer Feb 13 '19 at 13:59

0 Answers0