Extensions: [storage-resize-images] WebP support

Created on 14 Feb 2020  路  5Comments  路  Source: firebase/extensions

Seems MIME type image/webp is not support.

Error when resizing image { ChildProcessError: `convert /tmp/userDatas/6SaZVbNpTFOwwezEmtIc52ScLYw1/room_covers/room_cover_1581643929734.webp -resize 200x200> /tmp/room_cover_1581643929734_200x200.webp` failed with code 1
    at ChildProcess.<anonymous> (/srv/node_modules/child-process-promise/lib/index.js:132:23)
    at emitTwo (events.js:126:13)
    at ChildProcess.emit (events.js:214:7)
    at maybeClose (internal/child_process.js:915:16)
    at Socket.stream.socket.on (internal/child_process.js:336:11)
    at emitOne (events.js:116:13)
    at Socket.emit (events.js:211:7)
    at Pipe._handle.close [as _onclose] (net.js:561:12)
  name: 'ChildProcessError',
  code: 1,
  childProcess: 
   ChildProcess {
     domain: 
      Domain {
        domain: null,
        _events: [Object],
        _eventsCount: 1,
        _maxListeners: undefined,
        members: [Array] },
     _events: { error: [Function], close: [Function] },
     _eventsCount: 2,
     _maxListeners: undefined,
     _closesNeeded: 3,
     _closesGot: 3,
     connected: false,
     signalCode: null,
     exitCode: 1,
     killed: false,
     spawnfile: 'convert',
     _handle: null,
     spawnargs: 
      [ 'convert',
        '/tmp/userDatas/6SaZVbNpTFOwwezEmtIc52ScLYw1/room_covers/room_cover_1581643929734.webp',
        '-resize',
        '200x200>',
        '/tmp/room_cover_1581643929734_200x200.webp' ],
     pid: 14,
     stdin: 
      Socket {
        connecting: false,
        _hadError: false,
        _handle: null,
        _parent: null,
        _host: null,
        _readableState: [Object],
        readable: false,
        domain: [Object],
        _events: [Object],
        _eventsCount: 2,
        _maxListeners: undefined,
        _writableState: [Object],
        writable: false,
        allowHalfOpen: false,
        _bytesDispatched: 0,
        _sockname: null,
        _pendingData: null,
        _pendingEncoding: '',
        server: null,
        _server: null,
        _idleNext: null,
        _idlePrev: null,
        _idleTimeout: -1,
        [Symbol(asyncId)]: 3152,
        [Symbol(bytesRead)]: 0 },
     stdout: 
      Socket {
        connecting: false,
        _hadError: false,
        _handle: null,
        _parent: null,
        _host: null,
        _readableState: [Object],
        readable: false,
        domain: [Object],
        _events: [Object],
        _eventsCount: 3,
        _maxListeners: undefined,
        _writableState: [Object],
        writable: false,
        allowHalfOpen: false,
        _bytesDispatched: 0,
        _sockname: null,
        _pendingData: null,
        _pendingEncoding: '',
        server: null,
        _server: null,
        _idleNext: null,
        _idlePrev: null,
        _idleTimeout: -1,
        write: [Function: writeAfterFIN],
        [Symbol(asyncId)]: 3153,
        [Symbol(bytesRead)]: 0 },
     stderr: 
      Socket {
        connecting: false,
        _hadError: false,
        _handle: null,
        _parent: null,
        _host: null,
        _readableState: [Object],
        readable: false,
        domain: [Object],
        _events: [Object],
        _eventsCount: 3,
        _maxListeners: undefined,
        _writableState: [Object],
        writable: false,
        allowHalfOpen: false,
        _bytesDispatched: 0,
        _sockname: null,
        _pendingData: null,
        _pendingEncoding: '',
        server: null,
        _server: null,
        _idleNext: null,
        _idlePrev: null,
        _idleTimeout: -1,
        write: [Function: writeAfterFIN],
        [Symbol(asyncId)]: 3154,
        [Symbol(bytesRead)]: 354 },
     stdio: [ [Object], [Object], [Object] ] },
  stdout: '',
  stderr: 'convert-im6.q16: delegate failed `\'dwebp\' -pam \'%i\' -o \'%o\'\' @ error/delegate.c/InvokeDelegate/1919.\nconvert-im6.q16: unable to open file `/tmp/magick-14rI_0cWl78wVr\': No such file or directory @ error/constitute.c/ReadImage/544.\nconvert-im6.q16: no images defined `/tmp/room_cover_1581643929734_200x200.webp\' @ error/convert.c/ConvertImageCommand/3258.\n' }
blocked in-review bug

Most helpful comment

This is now live, you can update your extension by following the instructions in https://firebase.google.com/docs/extensions/manage-installed-extensions?platform=console#update-version

All 5 comments

Have tested and can confirm that this MIME type is not supported. Will look into it.

After testing locally, I can confirm that the ImageMagick used under the hood by Cloud Functions is able to convert webp images. However, I'm using the latest version of ImageMagick. I suspect that the Cloud Functions are using an older version.

Cloud Functions use Ubuntu OS: https://cloud.google.com/functions/docs/concepts/exec

This link makes me wonder whether ImageMagick version might need updating, or further packages need to be installed: https://askubuntu.com/questions/251950/imagemagick-convert-cant-convert-to-webp

Unfortunately, I cannot find the ImageMagick version Cloud Functions are using as only the packages are referenced: https://cloud.google.com/functions/docs/reference/nodejs-system-packages

Hi @laurenzlong, would you be able to confirm the ImageMagick version used by Cloud Functions, please?

I'm not sure but there's an easy way to find out! Deploy a function that has "npm" as a node module, and use npm view (https://docs.npmjs.com/cli-commands/view.html) to print out info about the package.

This has a PR (#207) created that is currently in-review by the XFN team. Will update this issue once that decision has been made.

This is now live, you can update your extension by following the instructions in https://firebase.google.com/docs/extensions/manage-installed-extensions?platform=console#update-version

Was this page helpful?
0 / 5 - 0 ratings