Suggestions on how to run this within a Lambda environment #478
Open
Description
Hello,
Thank you for this package. Really cool stuff.
Im running in an issue and wondering if anyone else has encountered it.
I am trying to run webR in a lambda environment with esbuild
. I am running into the following error:
"Cannot find module '/var/task/webr-worker.js'","stackTrace":["Error: Cannot find module '/var/task/webr-worker.js'","
at Module._resolveFilename (node:internal/modules/cjs/loader:1225:15)","
at Module._load (node:internal/modules/cjs/loader:1051:27)","
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:174:12)","
at MessagePort.<anonymous> (node:internal/main/worker_thread:186:26)","
at [nodejs.internal.kHybridDispatch] (node:internal/event_target:820:20)","
at MessagePort.<anonymous> (node:internal/per_context/messageport:23:28)"],"code":"MODULE_NOT_FOUND","requireStack":[]}}
I am bundling my lambda with esbuild
using CDK with the default esbuild options for a NodejsFunction. I managed to track this down to this line (although there are other similar ones for different workers).
I took a look at my file after esbuild does the bundling and it looks like only the main file from the package is getting bundled:
// ../node_modules/webr/dist/webr.cjs
var require_webr = __commonJS({
"../node_modules/webr/dist/webr.cjs"(exports2, module2) {
There are no other entries in the file about webr
definitions.
Wondering if anyone has run into this and has any ideas on how to proceed? Appreciate the time.