Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module did not self register with Canvas Node in Serverless offline v12 #1706

Closed
alexluongfm opened this issue Jul 5, 2023 · 0 comments
Closed

Comments

@alexluongfm
Copy link

Bug Report

This is mainly to make this issue easy to google, and cross link with the canvas node not supporting worker_threads ticket. Similar to sharp module not registering issue.

Current Behavior
After running a handler, that invokes node-canvas once, the second and subsequent invocations gives a module did not self-register error. This gets fixed if I restart serverless offline

ANY /api/generate-canvas (λ: api)
✖ Unhandled exception in handler 'api'.
✖ Error: Module did not self-register: '/dev/serverless/node_modules/canvas/build/Release/canvas.node'.

Environment

  • canvas version: [2.11.0]
  • serverless version: [3.31.0
  • serverless-offline version: [12.0.4]
  • node.js version: [v18.16.0]
  • OS: [Ubuntu 22.04]

Possible Solution

Worker threads not supported in canvas, need to switch to inProcess. This does mean hot reloading handlers doesn't work anymore, unfortunate.

Run serverless offline with the flag: --useInProcess.
Eg serverless offline start --useInProcess

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant