5

The cloud function was working good before updating it. This is the code where the error occurs now:

return spawn('convert' ,[tempLocalFile, '-thumbnail', `${THUMB_MAX_WIDTH}x${THUMB_MAX_HEIGHT}`, tempLocalThumbFile], {capture: ['stdout', 'stderr']});

Below is the detail of the error:

generateThumbnail Error: { 
     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) 
     code: 'ENOENT', 
     errno: 'ENOENT', 
     syscall: 'spawn convert', 
     path: 'convert', 
     spawnargs: [ 
          '/tmp/images/E32NIXQKgVUxjUGDmPkr_aaaa', 
          '-thumbnail', 
          '400x220', 
          '/tmp/images/thumb_E32NIXQKgVUxjUGDmPkr_aaaa' 
     ] 
}

Is I'm doing something wrong or Is this the firebase cloud error?

Muhammad Mehar
  • 1,015
  • 7
  • 10
  • What file format are you trying to convert? If PDF, then a change to your ImageMagick policy.xml file may be needed for recent Linux undates. If this is the case, then see https://stackoverflow.com/questions/52861946/imagemagick-not-authorized-to-convert-pdf-to-an-image/52863413#52863413. If you are using ImageMagick 7, then it uses magick rather than convert. Check to see if your have IM 7 or IM 6. If the former, your other software might require IM 6 so as to use convert. – fmw42 Oct 27 '18 at 17:28
  • I'm trying to convert jpg image file to a thumbnail as mention in the detail. I'm following the documentation of firebase see [https://firebase.google.com/docs/functions/gcp-storage-events](https://firebase.google.com/docs/functions/gcp-storage-events). The code was working good before updating the cloud function. – Muhammad Mehar Oct 28 '18 at 14:43

1 Answers1

1

For local development : brew install imagemagick

Damien Romito
  • 9,801
  • 13
  • 66
  • 84