generate-thumbnail sample: ImageMagick functionality unavailable ENOENT
See original GitHub issueHow 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:
- Created 5 years ago
- Reactions:5
- Comments:7
Top GitHub Comments
@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.@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”