firebase / firebase/functions-samples
generate-thumbnail sample: ImageMagick functionality unavailable ENOENT
- Dominant language
- JavaScript
- Stars
- 12.2k
- Forks
- 3.8k
- Avg merge
- 3d 23h
- Merged PRs (30d)
- 1
Description
### 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.
Contributor guide
Assessment
This issue has not been assessed yet.