catdad-experiments / heic-convert

šŸ¤³ convert heic/heif images to jpeg and png

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot pass non-string to std::string error

hisham opened this issue Ā· comments

I'm trying to use this lib but keep getting this error:

  BindingError {
     name: 'BindingError',
     message: 'Cannot pass non-string to std::string',
     stack: 'BindingError: Cannot pass non-string to std::string\n' +
       '    at BindingError.<anonymous> (/Users/hisham/src/ess-app/packages/cli/node_modules/libheif-js/libheif/libheif.js:1:178858)\n' +
       '    at new BindingError (eval at createNamedFunction (/Users/hisham/src/ess-app/packages/cli/node_modules/libheif-js/libheif/libheif.js:18:11916), <anonymous>:4:34)\n' +
       '    at throwBindingError (/Users/hisham/src/ess-app/packages/cli/node_modules/libheif-js/libheif/libheif.js:1:182383)\n' +
       '    at Object.toWireType (/Users/hisham/src/ess-app/packages/cli/node_modules/libheif-js/libheif/libheif.js:1:209812)\n' +
       '    at Object.heif_context_read_from_memory (eval at new_ (/Users/hisham/src/ess-app/packages/cli/node_modules/libheif-js/libheif/libheif.js:1:203780), <anonymous>:8:26)\n' +
       '    at HeifDecoder.decode (/Users/hisham/src/ess-app/packages/cli/node_modules/libheif-js/libheif/libheif.js:18:10575)\n' +
       '    at decodeBuffer (/Users/hisham/src/ess-app/packages/cli/node_modules/heic-decode/index.js:52:24)\n' +
       '    at module.exports (/Users/hisham/src/ess-app/packages/cli/node_modules/heic-decode/index.js:69:46)\n' +
       '    at convert (/Users/hisham/src/ess-app/packages/cli/node_modules/heic-convert/index.js:39:25)\n' +
       '    at module.exports (/Users/hisham/src/ess-app/packages/cli/node_modules/heic-convert/index.js:56:70)\n' +
       '    at ImageService.convertHEICToJpeg (/Users/hisham/src/ess-app/packages/cli/src/utils/image.service.ts:26:22)\n' +
       '    at Object.<anonymous> (/Users/hisham/src/ess-app/packages/cli/src/utils/image.service.test.ts:14:39)\n' +
       '    at Object.asyncJestTest (/Users/hisham/src/ess-app/packages/cli/node_modules/jest-jasmine2/build/jasmineAsyncInstall.js:106:37)\n' +
       '    at /Users/hisham/src/ess-app/packages/cli/node_modules/jest-jasmine2/build/queueRunner.js:45:12\n' +
       '    at new Promise (<anonymous>)\n' +
       '    at mapper (/Users/hisham/src/ess-app/packages/cli/node_modules/jest-jasmine2/build/queueRunner.js:28:19)\n' +
       '    at /Users/hisham/src/ess-app/packages/cli/node_modules/jest-jasmine2/build/queueRunner.js:75:41\n' +
       '    at processTicksAndRejections (internal/process/task_queues.js:97:5)'
   }

Do you have any code to reproduce this issue? Does this happen with only one or all images?

I investigated, and it appears that this only happens if I run heic-convert within a jest testing environment.

The fix suggested at emscripten-core/emscripten#8400 (comment) resolved it for me! Very weird.

Feel free to close this issue if you want. It appears when emscripten-core/emscripten#8400 is resolved this will resolve as well..