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
We use yarn pnp approach for managing our packages.
And serverless-offline works if we use one process for handling all functions
But in this case, as we have a lot of functions executed, after some time we get Javascript heap of memory error that is was reported by someone else here
As a solution, we decided to use "--useChildProcesses" flag (Run handlers in a child process)
And for our other project that uses regular npm with node_modules it works fine.
But for the project that uses yarn pnp we got another error.
Error:
Error: Cannot find module '/home/username/dev/myProjectName/.yarn/virtual/serverless-offline-virtual-66d2b3ea74/0/cache/serverless-offline-npm-8.8.0-0905a4015f-cc9ebc2016.zip/node_modules/serverless-offline/dist/lambda/handler-runner/worker-thread-runner/workerThreadHelper.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
at Function.Module._load (internal/modules/cjs/loader.js:746:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
at MessagePort. (internal/main/worker_thread.js:187:24)
at MessagePort.[nodejs.internal.kHybridDispatch] (internal/event_target.js:399:24)
at MessagePort.exports.emitMessage (internal/per_context/messageport.js:18:26)
Error: Command failed: yarn run start
Bug Report
Hello
We use yarn pnp approach for managing our packages.
And serverless-offline works if we use one process for handling all functions
But in this case, as we have a lot of functions executed, after some time we get Javascript heap of memory error that is was reported by someone else here
As a solution, we decided to use "--useChildProcesses" flag (Run handlers in a child process)
And for our other project that uses regular npm with node_modules it works fine.
But for the project that uses yarn pnp we got another error.
packages/api/package.json:
... "serverless": "^3.18.2", "serverless-offline": "^8.8.0", ...
Current Behavior
sls offline --httpPort 3000 --useChildProcesses
`
┌─────────────────────────────────────────────────────────────────────────────┐
│ │
│ GET | http://0.0.0.0:3000/api/v1/openapi │
│ POST | http://0.0.0.0:3000/2015-03-31/functions/apiVersion1/invocations │
│ GET | http://0.0.0.0:3000/api/v1/client-config │
│ POST | http://0.0.0.0:3000/2015-03-31/functions/apiVersion1/invocations │
│ ANY | http://0.0.0.0:3000/api/v1/{any*} │
│ POST | http://0.0.0.0:3000/2015-03-31/functions/apiVersion1/invocations │
│ │
└─────────────────────────────────────────────────────────────────────────────┘
Server ready: http://0.0.0.0:3000 🚀
Enter "rp" to replay the last request
internal/modules/cjs/loader.js:905
throw err;
^
Error: Cannot find module '/home/username/dev/myProjectName/.yarn/virtual/serverless-offline-virtual-66d2b3ea74/0/cache/serverless-offline-npm-8.8.0-0905a4015f-cc9ebc2016.zip/node_modules/serverless-offline/dist/lambda/handler-runner/child-process-runner/childProcessHelper.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
at Function.Module._load (internal/modules/cjs/loader.js:746:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
at internal/main/run_main_module.js:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
`
Also, we tried using --useWorkerThreads but got a similar error
sls offline --httpPort 3000 --useWorkerThreads
`
┌─────────────────────────────────────────────────────────────────────────────┐
│ │
│ GET | http://0.0.0.0:3000/api/v1/openapi │
│ POST | http://0.0.0.0:3000/2015-03-31/functions/apiVersion1/invocations │
│ GET | http://0.0.0.0:3000/api/v1/client-config │
│ POST | http://0.0.0.0:3000/2015-03-31/functions/apiVersion1/invocations │
│ ANY | http://0.0.0.0:3000/api/v1/{any*} │
│ POST | http://0.0.0.0:3000/2015-03-31/functions/apiVersion1/invocations │
│ │
└─────────────────────────────────────────────────────────────────────────────┘
Server ready: http://0.0.0.0:3000 🚀
Enter "rp" to replay the last request
✖ Uncaught exception
Environment: linux, node 14.18.2, framework 3.18.2 (local), plugin 6.2.2, SDK 4.3.2
Docs: docs.serverless.com
Support: forum.serverless.com
Bugs: github.com/serverless/serverless/issues
Error:
Error: Cannot find module '/home/username/dev/myProjectName/.yarn/virtual/serverless-offline-virtual-66d2b3ea74/0/cache/serverless-offline-npm-8.8.0-0905a4015f-cc9ebc2016.zip/node_modules/serverless-offline/dist/lambda/handler-runner/worker-thread-runner/workerThreadHelper.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
at Function.Module._load (internal/modules/cjs/loader.js:746:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
at MessagePort. (internal/main/worker_thread.js:187:24)
at MessagePort.[nodejs.internal.kHybridDispatch] (internal/event_target.js:399:24)
at MessagePort.exports.emitMessage (internal/per_context/messageport.js:18:26)
Error: Command failed: yarn run start
`
Our project structure:
myProjectName/
----/packages
--------/api
------------/src
------------/package.json
------------/serverless.yml
------------/webpack.config.js
----/.pnp.cjs
----/.pnp.loader.mjs
----/package.json
Expected behavior/code
Environment
serverless
version: v3.18.2serverless-offline
version: v8.8.0node.js
version: v14.18.2OS
: Debian 11The text was updated successfully, but these errors were encountered: