question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Started getting the Error: Cannot find module '@sls-next/next-aws-cloudfront'

See original GitHub issue

Describe the bug My deployments have been working well on AWS being ran by code build. Today I suddenly got an error for my builds on two separate AWS instances with the error:

{ Error: Cannot find module '@sls-next/next-aws-cloudfront'
--
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.resolve (internal/modules/cjs/helpers.js:33:19)
at Builder.<anonymous> (/root/.serverless/components/registry/npm/serverless-next.js@1.15.0-alpha.2/node_modules/@sls-next/lambda-at-edge/dist/build.js:119:49)
at Generator.next (<anonymous>)
at /root/.serverless/components/registry/npm/serverless-next.js@1.15.0-alpha.2/node_modules/@sls-next/lambda-at-edge/dist/build.js:8:71
at new Promise (<anonymous>)
at __awaiter (/root/.serverless/components/registry/npm/serverless-next.js@1.15.0-alpha.2/node_modules/@sls-next/lambda-at-edge/dist/build.js:4:12)
at Builder.buildDefaultLambda (/root/.serverless/components/registry/npm/serverless-next.js@1.15.0-alpha.2/node_modules/@sls-next/lambda-at-edge/dist/build.js:98:16)
at Builder.<anonymous> (/root/.serverless/components/registry/npm/serverless-next.js@1.15.0-alpha.2/node_modules/@sls-next/lambda-at-edge/dist/build.js:266:24)
at Generator.next (<anonymous>) code: 'MODULE_NOT_FOUND' }
·[G·[?25h·[G·[J
64s › myApp › Error: Cannot find module '@sls-next/next-aws-cloudfront'

Expected behaviour Ideally the deployment should give a success and output the cloudfront link.

Additional context I haven’t had any package related issue with the package and I’m running using the following in my package JSON.

    "serverless": "^1.67.0",
    "serverless-next.js": "^1.9.5",

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:10
  • Comments:17 (6 by maintainers)

github_iconTop GitHub Comments

12reactions
danielcondemarincommented, Jul 1, 2020

Hi folks, please pin the version number in your serverless.yml like it states in the README. For example:

myNextApplication:
  component: "serverless-next.js@1.9.5"
3reactions
zoozalpcommented, Jul 12, 2020

Thank you @danielcondemarin , it worked nicely after deleting existing cloudfront distribution and lambdas.

# serverless.yml
myApp:
 component: "@sls-next/serverless-component@1.15.1"

and my lambdas are named properly now. 🎉🎉🎉

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I resolve "Cannot find module" error using Node.js?
Using npm install installs the module into the current directory only (in a subdirectory called node_modules ). Is app.js located under ...
Read more >
cannot find module [Node npm Error Solved] - freeCodeCamp
I'm getting the error because I'm trying to import the freeCodeCamp icon from the react-icons package, which I don't have installed. import { ......
Read more >
Error: Cannot find module 'default-browser-id' in v.6.5.2 #18268
But just running to start-storybook in v6.5.2 should reproduce this error, I assume. System. Environment Info: System: OS: macOS 12.4 CPU: (8) ...
Read more >
ServiceNow Community servicenow community
I am trying to setup the CLI for component development and get the infamous error "keytar module" not found. Can someone tell me...
Read more >
How to resolve "Cannot find module" error in Node - Sabe.io
When you are working in Node, you will sometimes encounter the error Cannot find module 'module-name' with the error code MODULE_NOT_FOUND .
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found