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'.
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
Environment
canvas
version: [2.11.0]serverless
version: [3.31.0serverless-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
. Egserverless offline start --useInProcess