Closed andrewgadziksonos closed 3 years ago
Hi :wave:, thanks for opening! While we look into this...
If this issue is related to custom domains, be sure to check the custom domains troubleshooting guide to see if that helps. Also, there is a more general troubleshooting FAQ that may be helpful for other questions.
Lastly, please make sure you've specified the App ID
and Region
in the issue!
@andrewgadziksonos sorry you are facing this issue, i have a change that will provide better error logging which will be deployed in the coming weeks, but I looked up the build logs and it appears to be an issue with TypeScript + Webpack5: Error: Cannot find module 'webpack'
I would suggest trying to downgrade your Next.js version to 10.2.0 or 10.0.0 as we only support 9.x.x: https://docs.aws.amazon.com/amplify/latest/userguide/server-side-rendering-amplify.html#nextjs-version-support
No worries! Not sure how I missed that version requirement, I feel silly 😅 - I appreciate the help.
Is there a way for me to check these logs myself or is this more of an internal log system?
Also having the same issue myself and wondering how I can get better logs around it. Using NextJS 10.0.8 so probably related but better logs would be appreciated
Hi QB3L were you able to resolve this issue. I am also facing the same issue with NextJS 10.0.7
I am getting the following error
2021-06-16T21:08:30.160Z [INFO]: ----- Exported Successfully ----- 2021-06-16T21:08:30.165Z [INFO]: Starting SSR Build... 2021-06-16T21:09:54.631Z [ERROR]: Internal error
This is what my amplify.yml file looks like `version: 1 frontend: phases: preBuild: commands:
build: commands:
baseDirectory: out files:
This is what my package.json file looks like
"scripts": { "web": "node scripts/set-next-env-config.js $npm_config_env dev", "build": "node scripts/set-next-env-config.js $npm_config_env build", "start-web": "node scripts/set-next-env-config.js $npm_config_env start", "android": "node scripts/set-mob-env-config.js $npm_config_env run-android", "ios": "node scripts/set-mob-env-config.js $npm_config_env run-ios", "android-build": "node scripts/set-mob-env-config.js $npm_config_env run-android build", "start-mobile": "node scripts/set-mob-env-config.js $npm_config_env start", "test": "jest", "lint": "eslint .", "fastlane": "node scripts/run-fastlane.js $npm_config_env all", "export-ios": "node scripts/run-fastlane.js $npm_config_env ios", "export-android": "node scripts/run-fastlane.js $npm_config_env android" },
Unfortunately @tajindersinghminhas I have not been able to figure it out and opened up this issue I have tried simplifying the project to see if I can perhaps the specific library that may be causing issues but no luck yet
Hi QB3L were you able to resolve this issue. I am also facing the same issue with NextJS 10.0.7
I am getting the following error
2021-06-16T21:08:30.160Z [INFO]: ----- Exported Successfully ----- 2021-06-16T21:08:30.165Z [INFO]: Starting SSR Build... 2021-06-16T21:09:54.631Z [ERROR]: Internal error
This is what my amplify.yml file looks like
version: 1 frontend: phases: preBuild: commands: - npm install # IMPORTANT - Please verify your build commands build: commands: - npm run build --env=dev artifacts: # IMPORTANT - Please verify your build output directory baseDirectory: out files: - "**/*" cache: paths: - node_modules/**/* - .next/cache/**/*
I have been following all these threads but no concrete resolutions.This is what my package.json file looks like
"scripts": { "web": "node scripts/set-next-env-config.js $npm_config_env dev", "build": "node scripts/set-next-env-config.js $npm_config_env build", "start-web": "node scripts/set-next-env-config.js $npm_config_env start", "android": "node scripts/set-mob-env-config.js $npm_config_env run-android", "ios": "node scripts/set-mob-env-config.js $npm_config_env run-ios", "android-build": "node scripts/set-mob-env-config.js $npm_config_env run-android build", "start-mobile": "node scripts/set-mob-env-config.js $npm_config_env start", "test": "jest", "lint": "eslint .", "fastlane": "node scripts/run-fastlane.js $npm_config_env all", "export-ios": "node scripts/run-fastlane.js $npm_config_env ios", "export-android": "node scripts/run-fastlane.js $npm_config_env android" },
Hi, currently Amplify only supports 9.x.x of Next.js https://docs.aws.amazon.com/amplify/latest/userguide/server-side-rendering-amplify.html#nextjs-version-support
Could you downgrade to Next js version and try to redeploy?
Hey @victorccccc I did downgrade and was able to get more info at least, it seems there is an issue with this pg-native module which is related to the pg module for postgres connections.
My appId: dnuxde5s48b4y
exitCode: 1,
signal: undefined,
signalDescription: undefined,
stdout: 'build id: code-pipeline-1622207196156-a9bab94b10074e143e2e0ef63d73ecab8a7479e2\n' +
'info - Creating an optimized production build...',
stderr: 'Browserslist: caniuse-lite is outdated. Please run:\n' +
'npx browserslist@latest --update-db\n' +
'Failed to compile.\n' +
'\n' +
"ModuleNotFoundError: Module not found: Error: Can't resolve 'pg-native' in '/codebuild/output/src546776359/src/healtharmor-nextjs/node_modules/pg/lib/native'\n" +
'\n' +
'\n' +
'> Build error occurred\n' +
'Error: > Build failed because of webpack errors\n' +
' at build (/codebuild/output/src546776359/src/healtharmor-nextjs/node_modules/next/dist/build/index.js:15:918)\n' +
' at runMicrotasks (<anonymous>)\n' +
' at processTicksAndRejections (internal/process/task_queues.js:97:5)',
failed: true,
timedOut: false,
isCanceled: false,
Terminating logging...
Hey @victorccccc I did downgrade and was able to get more info at least, it seems there is an issue with this pg-native module which is related to the pg module for postgres connections.
My appId: dnuxde5s48b4y
exitCode: 1, signal: undefined, signalDescription: undefined, stdout: 'build id: code-pipeline-1622207196156-a9bab94b10074e143e2e0ef63d73ecab8a7479e2\n' + 'info - Creating an optimized production build...', stderr: 'Browserslist: caniuse-lite is outdated. Please run:\n' + 'npx browserslist@latest --update-db\n' + 'Failed to compile.\n' + '\n' + "ModuleNotFoundError: Module not found: Error: Can't resolve 'pg-native' in '/codebuild/output/src546776359/src/healtharmor-nextjs/node_modules/pg/lib/native'\n" + '\n' + '\n' + '> Build error occurred\n' + 'Error: > Build failed because of webpack errors\n' + ' at build (/codebuild/output/src546776359/src/healtharmor-nextjs/node_modules/next/dist/build/index.js:15:918)\n' + ' at runMicrotasks (<anonymous>)\n' + ' at processTicksAndRejections (internal/process/task_queues.js:97:5)', failed: true, timedOut: false, isCanceled: false, Terminating logging...
Update: You could add - yum install postgresql-devel -y
in your build specification - preBuild
phase (ref: https://www.npmjs.com/package/pg-native)
Hey, According to these references:
Unfortunately, some Node.js packages (especially native bindings, e.g. pg-native in this case) cannot be easily bundled using Webpack.
You may need to adjust your webpack configuration (ref #1)or ignore this plugin (ref #2)
We are sorry to know this. Currently, Internal Error
needs to be reviewed case by case. Could you provide your appId for us to lookup please? Thanks @tajindersinghminhas
I got same this issue too. Anyone can help?
λ (Server) server-side renders at runtime (uses getInitialProps or getServerSideProps) ○ (Static) automatically rendered as static HTML (uses no initial props) ● (SSG) automatically generated as static HTML + JSON (uses getStaticProps) (ISR) incremental static regeneration (uses revalidate in getStaticProps) 2021-06-23T02:49:27.849Z [INFO]: Starting SSR Build... 2021-06-23T02:50:48.824Z [ERROR]: Internal error Terminating logging...
I got same this issue too. Anyone can help?
λ (Server) server-side renders at runtime (uses getInitialProps or getServerSideProps) ○ (Static) automatically rendered as static HTML (uses no initial props) ● (SSG) automatically generated as static HTML + JSON (uses getStaticProps) (ISR) incremental static regeneration (uses revalidate in getStaticProps) 2021-06-23T02:49:27.849Z [INFO]: Starting SSR Build... 2021-06-23T02:50:48.824Z [ERROR]: Internal error Terminating logging...
Hi @vuongnguyenthanh-agilityio, Could you provide your AppId? Thanks
@victorccccc My AppId: d3r71rj9jv8heq
. Thanks for help
@victorccccc My AppId:
d3r71rj9jv8heq
. Thanks for help
@vuongnguyenthanh-agilityio We saw AccessDenied
error in our logs, please make sure you set correct Service Role in Amplify Console, thanks.
@victorccccc I am using service role with policy AdministratorAccess
. But I don't know why I got the AccessDenied
error. Can you help to check again?
@victorccccc - My App ID - d3eyxgyk7b3qii
@victorccccc I am using service role with policy
AdministratorAccess
. But I don't know why I got theAccessDenied
error. Can you help to check again?
Hi, @vuongnguyenthanh-agilityio can you confirm AdministratorAccess
policy is attached to amplify-backend-role
? I cannot reproduce your issue
@victorccccc - My App ID - d3eyxgyk7b3qii
From our logs, Error for latest build 33 is
Error: Cannot find module 'private-next-pages/app.mobile.js' at webpackMissingModule (/codebuild/output/src103070434/src/cpynew-frontend/.next/serverless/pages/app.mobile.js:143560:87)
We are working on the improvement of logging. Thanks for the understanding
@victorccccc I am using service role with policy
AdministratorAccess
. But I don't know why I got theAccessDenied
error. Can you help to check again?Hi, @vuongnguyenthanh-agilityio can you confirm
AdministratorAccess
policy is attached toamplify-backend-role
? I cannot reproduce your issue
Thanks for your help @victorccccc. I attached AdministratorAccess
policy into amplify-backend-role
role. But I still got the same the isssue
@victorccccc I am also having this issue repeatedly. It wasn't an issue at first, but just started cropping. My appID is: dv8ybb6qjbg9d. It's happening in pr-53 (not currently master). Thanks in advance for an help
Hi @victorccccc
From our logs, Error for latest build 33 is
Error: Cannot find module 'private-next-pages/app.mobile.js' at webpackMissingModule (/codebuild/output/src103070434/src/cpynew-frontend/.next/serverless/pages/app.mobile.js:143560:87)
We are working on the improvement of logging. Thanks for the understanding
In the meantime, where can we find these logs ourselves? Can we find them on CloudWatch or run the command locally somehow? That would be very helpful to analyze a similar problem we are having.
Also, would you be so kind as to explain us what command is causing the "Starting SSR Build... Internal error" lines?
Thanks!
Hi, I have the same Internal error issue like some people. My appId is: d1jq8wr0iuaxel
Thanks in advance
2021-07-01T13:13:02.848Z [INFO]: λ (Server) server-side renders at runtime (uses getInitialProps or getServerSideProps) ○ (Static) automatically rendered as static HTML (uses no initial props) ● (SSG) automatically generated as static HTML + JSON (uses getStaticProps) (ISR) incremental static regeneration (uses revalidate in getStaticProps) 2021-07-01T13:13:03.091Z [INFO]: Starting SSR Build... 2021-07-01T13:14:52.475Z [ERROR]: Internal error Terminating logging...
We're also experiencing a vague internal error with increasing frequency:
2021-07-01T17:46:33.790Z [INFO]: λ (Server) server-side renders at runtime (uses getInitialProps or getServerSideProps)
○ (Static) automatically rendered as static HTML (uses no initial props)
● (SSG) automatically generated as static HTML + JSON (uses getStaticProps)
(ISR) incremental static regeneration (uses revalidate in getStaticProps)
2021-07-01T17:46:33.938Z [INFO]: Done in 23.39s.
2021-07-01T17:46:33.943Z [INFO]: Starting SSR Build...
2021-07-01T17:48:05.238Z [ERROR]: Internal error
My app id is: ddng4mtfv633m Region: us-east-2 Preview branch showing error at this time: pr-47
Any additional troubleshooting advice would help. Thank you!
Hi there, please is there update or idea on what this could be.
2021-07-02T20:25:38.854Z [INFO]: λ (Server) server-side renders at runtime (uses getInitialProps or getServerSideProps) ○ (Static) automatically rendered as static HTML (uses no initial props) ● (SSG) automatically generated as static HTML + JSON (uses getStaticProps) (ISR) incremental static regeneration (uses revalidate in getStaticProps) 2021-07-02T20:25:39.045Z [INFO]: Starting SSR Build... Terminating logging...
Same here
2021-07-02T20:36:35.111Z [INFO]: λ (Server) server-side renders at runtime (uses getInitialProps or getServerSideProps)
○ (Static) automatically rendered as static HTML (uses no initial props)
● (SSG) automatically generated as static HTML + JSON (uses getStaticProps)
(ISR) incremental static regeneration (uses revalidate in getStaticProps)
2021-07-02T20:36:35.267Z [INFO]: Done in 41.93s.
2021-07-02T20:36:35.271Z [INFO]: Starting SSR Build...
2021-07-02T20:37:59.990Z [ERROR]: Internal error
Terminating logging...
may app id is d2ecz8cl98drop
same error for me using next v 10
2021-07-02T21:34:32.540Z [INFO]: λ (Server) server-side renders at runtime (uses getInitialProps or getServerSideProps)
○ (Static) automatically rendered as static HTML (uses no initial props)
● (SSG) automatically generated as static HTML + JSON (uses getStaticProps)
(ISR) incremental static regeneration (uses revalidate in getStaticProps)
2021-07-02T21:34:32.736Z [INFO]: Starting SSR Build...
Terminating logging...
Got the same error with v10. The attached role has AdministratorAccess
policy.
2021-07-03T00:04:07.579Z [INFO]: λ (Server) server-side renders at runtime (uses getInitialProps or getServerSideProps)
○ (Static) automatically rendered as static HTML (uses no initial props)
● (SSG) automatically generated as static HTML + JSON (uses getStaticProps)
(ISR) incremental static regeneration (uses revalidate in getStaticProps)
2021-07-03T00:04:07.688Z [INFO]: Starting SSR Build...
Terminating logging...
Possibly because I use some private packages. I put npm token into Amplify App Settings env (and it works - build is successful) but maybe I should put it somewhere else?
@victorccccc, could you shine any light on when you will support NextJS v10/11? It is almost 8 months old and has some really powerful optimisations that I think most of the community would be keen to have access to.
also have the same problem, d26abm7d659424
region eu-west-1
would appreciate log clarity since it's super urgent
FYI, in our case, we have contacted AWS business support and managed after a few days to get the detailed logs regarding our SSR build internal error. As said, they are currently working on improving the Amplify build log.
Regarding our particular case, if this helps some of you, we are using next
module with next-i18next
module for internationalization of our app. However it seems that older version of next-i18next
are not working over the latest Amplify SSR support of Lambda@Edge. This has been fixed in recent next-i18next
version >= 8 however this version requires next
module version >= 10 which is not officially (but mostly) supported on Amplify.
So we are in the process of attemting to use next
10 anyway as we don't have any way to disable SSR on Amplify as it was before it happened to be supported and the "Internal build" error we have is more specically the following:
Unhandled error during request: Error: Cannot find module '/codebuild/output/src174821515/src/handbook-web/next-i18next.config.js'
at webpackEmptyContext (/codebuild/output/src174821515/src/handbook-web/.next/serverless/pages/404.js:141609:10)
at /codebuild/output/src174821515/src/handbook-web/.next/serverless/pages/404.js:6356:73 {
code: 'MODULE_NOT_FOUND'
}
i have facing this issue my App Id : d2v4k9pnfyq03v
const withImages = require('next-images') module.exports = withImages({ exportTrailingSlash: true, webpack: (config, { buildId, dev, isServer, defaultLoaders, webpack }) => { config.optimization.splitChunks.cacheGroups = { } config.optimization.minimize = true; return config }, });
how to resolve this issue thanks advance
Same problem, the lag time for a major version bumps to be released is kinda crazy (v11 is already here...)
Any updates @victorccccc? @Athena96
Same problem
2021-07-12T12:24:24.701Z [INFO]: λ (Server) server-side renders at runtime (uses getInitialProps or getServerSideProps)
○ (Static) automatically rendered as static HTML (uses no initial props)
● (SSG) automatically generated as static HTML + JSON (uses getStaticProps)
(ISR) incremental static regeneration (uses revalidate in getStaticProps)
2021-07-12T12:24:24.903Z [INFO]: Starting SSR Build...
Terminating logging...
App d2ygnwbvrtqqk6
on eu-central-1
FYI, we have been able to deploy recent versions of Next.js (version >= 10.x) using Serverless Next.js Component Compared to Amplify frontend management, it doesn't support out of the box, multiple stage deployments (see FAQ at the end) but like it says it is very simple to use and supports recent Next.js versions as far as we have tested.
Also it has been super helpful to get logs about the "Internal Error" we were having on Amplify. Fixing these error on serverless deployment fixed Amplify frontend builds. However in our particular case, as Amplify doesn't support the new Next.js i18n routing, we sticked to serverless deployment and use Amplify only for the backend deployment from now on.
Finally, we were in contact with AWS support and sadly there is no ETA regarding support of Next.js version >=10 on Amplify for now.
Hoping this help some of you.
Hi all, we've recently made improvements to our SSR error logging and have added support for Next.js 10/11. Please follow this guide to upgrade to our latest support of Next.js: https://docs.aws.amazon.com/amplify/latest/userguide/server-side-rendering-amplify.html#update-app-nextjs-version
@Athena96 Same error here as pointed out by @dletozeun. I have tried following the guide to upgrade my Amplify environment, but with no success. It's seems when using NextJs i18n routing it's not possible to use Amplify to deploy a static web site.
Unhandled error during request: Error: Cannot find module '/codebuild/output/src891184255/src/landing-page/next-i18next.config.js'
at webpackEmptyContext (/codebuild/output/src891184255/src/landing-page/.next//pages/index.js:61192:10)
at /codebuild/output/src891184255/src/landing-page/.next//pages/index.js:2711:73```
This is most likely related to: https://github.com/aws-amplify/amplify-console/issues/2098
When adding sentry to my application, the issue with webpack not being recognized/found during the SSR portion of the build started appearing for me.
This is super annoying because nextjs has essentially no built in error support, and they strongly suggest using sentry for any error handling.
When adding sentry to my application, the issue with webpack not being recognized/found during the SSR portion of the build started appearing for me.
I'm having an issue like this, when adding @sentry/nextjs
and overriding creating error handling like this example. The error message I get when building is:
Error: Command failed with exit code 1: node_modules/.bin/next build
(node:1546) [DEP_WEBPACK_CHUNK_HAS_ENTRY_MODULE] DeprecationWarning: Chunk.hasEntryModule: Use new ChunkGraph API
Failed to compile.
./node_modules/next/dist/compiled/webpack/LICENSE
Module parse failed: Unexpected token (1:10)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
> Copyright JS Foundation and other contributors
|
| Permission is hereby granted, free of charge, to any person obtaining
> Build error occurred
Error: > Build failed because of webpack errors
I'm using aws amplify's logging instead now. I see logs available in cloudwatch for my regional lambda@edge distribution. Giving up on sentry for now.
@johnjensenish Were you able to solve that issue?
Failed to compile.
./node_modules/next/dist/compiled/webpack/LICENSE
Module parse failed: Unexpected token (1:10)
@johnjensenish Were you able to solve that issue?
Failed to compile. ./node_modules/next/dist/compiled/webpack/LICENSE Module parse failed: Unexpected token (1:10)
No, never figured this out.
I am also experiencing this issue and am seeing this in the build console:
2021-10-04T21:56:06.960Z [INFO]: Starting SSR Build...
2021-10-04T21:58:55.676Z [ERROR]: Error: Command failed with exit code 1: node_modules/.bin/next build
(node:1677) [DEP_WEBPACK_CHUNK_HAS_ENTRY_MODULE] DeprecationWarning: Chunk.hasEntryModule: Use new ChunkGraph API
(node:1677) [DEP_WEBPACK_CHUNK_ADD_MODULE] DeprecationWarning: Chunk.addModule: Use new ChunkGraph API
warn - Compiled with warnings
./node_modules/next/dist/server/load-components.js
Critical dependency: the request of a dependency is an expression
./node_modules/next/dist/server/load-components.js
Critical dependency: the request of a dependency is an expression
./node_modules/next/dist/server/load-components.js
Critical dependency: the request of a dependency is an expression
./node_modules/next/dist/server/require.js
Critical dependency: the request of a dependency is an expression
./node_modules/next/dist/server/require.js
Critical dependency: the request of a dependency is an expression
./node_modules/next/dist/server/require.js
Critical dependency: the request of a dependency is an expression
> Build error occurred
TypeError: Cannot read property 'Q' of undefined
Same issue here. Added Sentry on API Routes and now get SSR error on build.
Isn't this issue solved yet? I am using Next.js v11.
Has this been solved at all yet? Running into the same issue.
I was able to build my app with Sentry + Next.js 11 by using the steps in this issue. Not sure of other implications.
same issue.
Hi @dar0xt what error are you seeing? Can you share your appID and region?
I'm using NextJS v12 and getting this error, Can't resolve 'webpack'
Before opening, please confirm:
App Id
d1i7qtt97aq61n
Region
us-east-2
Amplify Console feature
Logging
Describe the bug
My NextJS application fails to build without any additional information. The build logs contain the following,
Expected behavior
I would expect to see detailed error messaging around why the build is failing
Reproduction steps
Build Settings
Additional information
I tried using
NODE_OPTIONS=--max-old-space-size=5120
but this didnt resolve the issueI followed along here as well
1853
1874
1882