question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CF error: "the gm/convert binaries can't be found"

See original GitHub issue

Version info

firebase-functions: 2.0.5

firebase-tools: 4.2.1

firebase-admin: 6.0.0

Test case

I use Imagick to scale images and to check their dimensions. Everything worked okay until yesterday, when CF started throwing errors when running Imagick commands using the npm module gm.

Steps to reproduce

Use Imagick in code. The code deploys successfully. But after some deploys the imagick cannot be used, and after some deploys, it can be.

const im = gm.subClass({ imageMagick: true });
// ...
im(tmpFilePath).identify('%w', (err, result) => {
// ...
})
// ...
im(tmpFilePath).scale(size, 0).write(targetFileName, err => {
// ...
})
// ...

Were you able to successfully deploy your functions?

Yes. No errors during deploy.

Expected behavior

Imagick binary is available. NPM module gm can be used. Just like two days ago.

Actual behavior

Using gm the following error occurs

Error: Could not execute GraphicsMagick/ImageMagick: identify "-ping" "-format" "%w" "/tmp/photo_1540550839532" this most likely means the gm/convert binaries can't be found
    at ChildProcess.<anonymous> (/srv/node_modules/gm/lib/command.js:232:12)
    at emitOne (events.js:116:13)
    at ChildProcess.emit (events.js:211:7)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:196:12)
    at onErrorNT (internal/child_process.js:372:16)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickDomainCallback (internal/process/next_tick.js:218:9)

Sometimes, after redeploy (with no change to the code whatsoever) it works, until there is a new deploy that brakes it. There is no way to tell if the deploy will have this problem without actually running the code.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
Flucadetenacommented, Nov 3, 2020

Hey @Jbz797 I did find the errors in my case. I opened two new issues that may help you.

Import gm with ES6 Use .webp

If you are using typescript as I was, the first issue is the one to follow. And the current solution is to import gm with require. You don’t get Types but it works.

Hope it helps! 😉

1reaction
Flucadetenacommented, Oct 24, 2020

Hi I’m running into the same issue. I’ve updated everything and theres now way I can solve the problem.

My dependencies:

"dependencies": {
    "@google-cloud/vision": "^2.1.2",
    "@sendgrid/mail": "^7.3.0",
    "@types/cors": "^2.8.8",
    "@types/gm": "^1.18.9",
    "@types/express": "4.17.7",
    "axios": "^0.21.0",
    "cors": "^2.8.5",
    "firebase-admin": "^9.3.0",
    "firebase-functions": "^3.11.0",
    "gm": "^1.23.1",
    "log4js": "^6.3.0"
  },
  "devDependencies": {
    "@types/node": "^14.14.2",
    "firebase-functions-test": "^0.2.2",
    "tslint": "^6.1.3",
    "typescript": "^4.0.3"
  }, 

The error:

Error treating the img and resizing: Error: Error: Could not execute GraphicsMagick/ImageMagick: gm "convert" "-quality" "50" "/tmp/original.jpg" "-fill" "rgb(247,247,247)" "-fuzz" "5%" "-opaque" "rgb(255,255,255)" "-resize" "1000x^" "+profile" "\"*\"" "+comment" "/tmp/1000.webp" this most likely means the gm/convert binaries can't be found

In local works perfectly. Thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

The gm/convert binaries can't be found · Issue #455 - GitHub
I am running Nodejs v4.1.1 in Windows 10 (64-bit). When I execute the following code: var gm = require('gm').subClass({imageMagick: true});.
Read more >
gm conversion issue in node.js - Stack Overflow
1. I got an error because I thought graphicsmagic will automatically download imagemagick also, but it's not. After seen your answer I installed ......
Read more >
Graphics Magick Version - Node - Alibaba Cloud
What ImageMagick binary version is installed and running (e.g. magick ... this most likely means the gm/convert binaries can\'t be found.
Read more >
Is there a way to convert webp to jpg using CF?
I provided simple command line examples to convert WEBP to JPG using both GraphicsMagick and ImageMagick. Install either. After a file with the ......
Read more >
Untitled
Feuerwehr vierzehnheiligen, Rza you can't stop me now lyrics. Daniel nacucchio y cristina sosa 2014, How to grow pineapple from top, Wcml tv,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found