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.

generate-thumbnail sample: ImageMagick functionality unavailable ENOENT

See original GitHub issue

How to reproduce these conditions

Sample name or URL where you found the bug generate-thumbnail

Failing Function code used (including require/import commands at the top)

const spawn = require('child-process-promise').spawn;
...
await spawn('convert', [tempLocalFile, '-thumbnail', `${THUMB_MAX_WIDTH}x${THUMB_MAX_HEIGHT}>`, tempLocalThumbFile], {capture: ['stdout', 'stderr']});

Steps to set up and reproduce Follow the steps in the README for setting up your own instance of the generate-thumbnail project. Upload an image to the project’s Storage View the logs

Security rules used Default rules for Storage IAM:

imagemagick-xxxxxx@appspot.gserviceaccount.com
   App Engine default service account
   Service Account Token Creator
   Storage Object Admin

Debug output

Error: spawn convert ENOENT
     at _errnoException (util.js:1022:11)
     at Process.ChildProcess._handle.onexit (internal/child_process.js:190:19)
     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) |  

Expected behavior

ImageMagick convert program spawns successfully and resizes the image according to supplied arguments

Actual behavior

Child process spawn fails, not finding the convert program, resulting in the error spawn convert ENOENT

Supporting Information

Try spawning identify

Tests with other ImageMagick executables also fail, for example, calling identify results in spawn identify ENOENT.

Use dpkg to see if ImageMagick is installed

Using spawn to run dpkg results in:

dpkg -L imagemagick
dpkg-query: package 'imagemagick' is not installed

Inspect the $PATH

Using ls and grep to look for convert in all directories in the $PATH finds nothing.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:5
  • Comments:7

github_iconTop GitHub Comments

1reaction
NimaiMallecommented, Nov 1, 2018

@Cdik Hey, I feel your pain, but you should file a separate support ticket or github issue for your storage bucket behavior. I totally understand that you’ve got an issue here! But it will reduce the team’s ability to triage and respond if we add multiple issues under one ticket. Please stick to additional information related to launching ImageMagick tools within Firebase Cloud Functions on this thread.

FYI - support did have me try deleting the function that used convert and then re-deploying it, and while anecdotal, it did start working for me after that.

1reaction
NimaiMallecommented, Oct 26, 2018

@rodrigomata I had updated a week or so ago, but just did now: $ firebase --version 6.0.0

Re-deployed. Same result, though. I notice when I use exec to run “convert”, I get a different error: “/bin/sh: 1: convert: not found”

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting a thumbnail from a video using Cloud Functions for ...
The code I currently have: exports.generateThumbnail = functions.storage.object().onChange(event ...
Read more >
ImageMagick v6 Examples -- Creating Thumbnails and Framing
Lets convert a large sample JPEG image to a GIF thumbnail 90 pixels high with the ... The normal way I generate thumbnail...
Read more >
Resizing or Scaling -- ImageMagick Examples
We look at enlarging and reducing images in various ways. The image remains intact and whole, but individual points of color merged or...
Read more >
Command-line Tools: Identify - ImageMagick
Example Usage • Option Summary. The magick identify program describes the format and ... magick identify -verbose -features 1 -moments -unique image.png.
Read more >
Annotated List of Command-line Options - ImageMagick
See also the -frame option, which has more functionality. ... For example for operators such as -auto-level and -auto-gamma the color channels are...
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