Home
Support Forums

Serverless errorMessage: Cannot find module on webxray.netlify.app

Hi there! I’m running a little experiment with Eleventy Serverless plugin. So far It works perfectly fine in development using netlify-cli. Although, when trying to invoke the netlify function in production I get this error:

{"errorType":"Error","errorMessage":"Cannot find module '/var/task/functions/getcode/eleventy-serverless-map.json'\nRequire stack:\n- /var/task/functions/getcode/index.js\n- /var/task/getcode.js\n- /var/runtime/UserFunction.js\n- /var/runtime/index.js","trace":["Error: Cannot find module '/var/task/functions/getcode/eleventy-serverless-map.json'","Require stack:","- /var/task/functions/getcode/index.js","- /var/task/getcode.js","- /var/runtime/UserFunction.js","- /var/runtime/index.js","    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)","    at Function.Module._load (internal/modules/cjs/loader.js:746:27)","    at Module.require (internal/modules/cjs/loader.js:974:19)","    at require (internal/modules/cjs/helpers.js:93:18)","    at Serverless.getContentMap (/var/task/functions/getcode/index.js:96618:26)","    at Serverless.isServerlessUrl (/var/task/functions/getcode/index.js:96629:31)","    at Runtime.handler (/var/task/functions/getcode/index.js:116025:14)","    at processTicksAndRejections (internal/process/task_queues.js:95:5)"]}

I get no error when deploying the site (https://webxray.netlify.app/) and the home page, which is static, loads without problems.

Environment

  • Dev OS : Linux Mint 20
  • Eleventy version : 1.0.0-canary.46
  • Netlify-cli : 8.1.7
  • Node : v14
  • NPM : 6.14.15

Hi @solution-loisir

I can see that you’ve already opened an issue here:

Plus, I can see that this has happened in the past too:

https://githubmemory.com/repo/11ty/eleventy/issues/1866

So I think the best bet for support is where you’ve opened the issue currently.