You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was trying to use the sharp module in my project and at the first run of the lambda handler everything works but after the lambda is cleanup (for idle timeout) I try to execute the handler again and I get the error:
Something went wrong installing the "sharp" module
Module did not self-register: '/home/.../project-app/node_modules/sharp/build/Release/sharp-linux-x64.node'.
Possible solutions:
- Using worker threads? See https://sharp.pixelplumbing.com/install#worker-threads
- Install with verbose logging and look for errors: "npm install --ignore-scripts=false --foreground-scripts --verbose sharp"
- Install for the current linux-x64 runtime: "npm install --platform=linux --arch=x64 sharp"
- Consult the installation documentation: https://sharp.pixelplumbing.com/install
I try to load the library in the main thread, basically I went to the node_modules/serverless-offline module and I load the sharp module in the index.js file and it works
So my purpose is to have a new configuration option to define shared modules that need to be loaded in the main thread. Something like:
I'm no very familiar with native modules running in worker threads, but it seems to me that that scenario can be supported. you could file a bug with the native plugin and ask if worker threads support could be added.
In order to be loaded from multiple Node.js environments, such as a main thread and a Worker thread, an add-on needs to either:
Be an Node-API addon, or
Be declared as context-aware using NODE_MODULE_INIT() as described above
in the meantime, you should be able to run your scenario in process (flag: --useInProcess), which does not use worker threads, but it also does not support handler reloading for development.
Bug Report
Hey everyone! 👋!
Current Behavior
I was trying to use the
sharp
module in my project and at the first run of the lambda handler everything works but after the lambda is cleanup (for idle timeout) I try to execute the handler again and I get the error:Sample Code
Expected behavior/code
The lambda handler should keep working after the cleanup.
Environment
serverless
version: 3.23.0serverless-offline
version: 11.1.3node.js
version: [e.g. v16.15.1]OS
: Manjaro LinuxPossible Solution
Based on this: https://sharp.pixelplumbing.com/install#worker-threads
I try to load the library in the main thread, basically I went to the node_modules/serverless-offline module and I load the
sharp
module in the index.js file and it worksSo my purpose is to have a new configuration option to define shared modules that need to be loaded in the main thread. Something like:
The text was updated successfully, but these errors were encountered: