0

I'm getting this error when I deploy my Lambda function:

module initialization error: Error
at Error (native)
at Object.Module._extensions..node (module.js:597:18)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at bindings (/var/task/node_modules/bindings/bindings.js:84:48)
at Object. (/var/task/node_modules/sharp/lib/constructor.js:10:34)
at Module._compile (module.js:570:32)

The serverless.yml and package.json: https://github.com/A-Atrash/forfilesharingtohandleerror. It's with Node. It used to work before I added a new package ImageMagick and started using it as an image validation. Any idea?

2 Answers 2

1

I believe you're creating your Lambda package from non-Linux environment (e.g. Windows or MacOS).

ImageMagick uses native modules so you when you do your npm install, it compiles it for your current environment. If you're in Windows or MacOS, this compiled package will not work Lambda (which uses Linux).

For it to work, your Lambda package has to be created in a Linux environment and then uploaded from there.

Sign up to request clarification or add additional context in comments.

1 Comment

Jeez! That's a log shot! Thanks anyway!
0

In my case it was source-map-support package that discarded the actual error message and stack trace. Once I commented out the source-map-support package import line then the error started showing the actual error message and stack trace.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.