aws-amplify / amplify-hosting

AWS Amplify Hosting provides a Git-based workflow for deploying and hosting fullstack serverless web applications.
https://aws.amazon.com/amplify/hosting/
Apache License 2.0
457 stars 115 forks source link

TypeError: Missing parameter name at 9 after Migration to Next.js 12 #3193

Closed adeelejaz closed 1 year ago

adeelejaz commented 1 year ago

Before opening, please confirm:

JavaScript Framework

Next.js

Amplify APIs

Authentication, GraphQL API

Amplify Categories

auth, api

Environment information

``` # Put output below this line System: OS: macOS 13.0.1 CPU: (8) arm64 Apple M1 Pro Memory: 336.13 MB / 32.00 GB Shell: 5.8.1 - /bin/zsh Binaries: Node: 16.14.2 - ~/.nvm/versions/node/v16.14.2/bin/node Yarn: 1.22.15 - ~/.nvm/versions/node/v16.14.2/bin/yarn npm: 8.19.1 - ~/.nvm/versions/node/v16.14.2/bin/npm Browsers: Chrome: 108.0.5359.98 Firefox: 107.0 Safari: 16.1 npmPackages: @ampproject/toolbox-optimizer: undefined () @aws-amplify/auth: ~4.6.0 => 4.6.14 @aws-amplify/cli: ^10.5.1 => 10.5.1 @aws-amplify/ui-react: ~3.5.0 => 3.5.11 @aws-amplify/ui-react-internal: undefined () @aws-amplify/ui-react-legacy: undefined () @babel/core: undefined () @babel/runtime: 7.15.4 @edge-runtime/primitives: 1.1.0-beta.31 @fortawesome/fontawesome-svg-core: ^6.2.1 => 6.2.1 @fortawesome/free-brands-svg-icons: ^6.2.1 => 6.2.1 @fortawesome/free-solid-svg-icons: ^6.2.1 => 6.2.1 @fortawesome/react-fontawesome: ^0.2.0 => 0.2.0 @hapi/accept: undefined () @headlessui/react: ^1.7.4 => 1.7.4 @napi-rs/triples: undefined () @next/react-dev-overlay: undefined () @prismicio/client: ^6.7.1 => 6.7.1 @prismicio/helpers: ^2.3.6 => 2.3.6 @prismicio/next: ^0.1.9 => 0.1.9 @prismicio/react: ^2.5.0 => 2.5.0 @segment/ajv-human-errors: undefined () @sentry/nextjs: ^7.23.0 => 7.23.0 @stripe/react-stripe-js: ^1.15.0 => 1.15.0 @stripe/stripe-js: ^1.44.1 => 1.44.1 @tailwindcss/aspect-ratio: ^0.4.0 => 0.4.2 @tailwindcss/forms: ^0.5.0 => 0.5.3 @tailwindcss/typography: ^0.5.8 => 0.5.8 @vercel/nft: undefined () acorn: undefined () amphtml-validator: undefined () arg: undefined () assert: undefined () async-retry: undefined () async-sema: undefined () autoprefixer: ^10.4.13 => 10.4.13 aws-amplify: ^4.3.43 => 4.3.43 babel-packages: undefined () browserify-zlib: undefined () browserslist: undefined () buffer: undefined () bytes: undefined () chalk: undefined () ci-info: undefined () classnames: ^2.3.1 => 2.3.2 (2.3.1) cli-select: undefined () comment-json: undefined () compression: undefined () conf: undefined () constants-browserify: undefined () content-disposition: undefined () content-type: undefined () cookie: undefined () critters: ^0.0.16 => 0.0.16 cross-spawn: undefined () crypto-browserify: undefined () cssnano-simple: undefined () dayjs: ^1.11.0 => 1.11.6 debug: undefined () devalue: undefined () domain-browser: undefined () edge-runtime: undefined () eslint: 8.25.0 => 8.25.0 eslint-config-next: 12.3.1 => 12.3.1 events: undefined () find-cache-dir: undefined () find-up: undefined () fresh: undefined () get-orientation: undefined () glob: undefined () gzip-size: undefined () hamburger-react: ^2.4.1 => 2.5.0 http-proxy: undefined () https-browserify: undefined () icss-utils: undefined () ignore-loader: undefined () image-size: undefined () is-animated: undefined () is-docker: undefined () is-wsl: undefined () jest-worker: undefined () js-cookie: ^3.0.1 => 3.0.1 (2.2.1) json5: undefined () jsonwebtoken: undefined () loader-utils: undefined () lodash.curry: undefined () lru-cache: undefined () micromatch: undefined () mini-css-extract-plugin: undefined () nanoid: undefined () native-url: undefined () neo-async: undefined () next: 12.3.1 => 12.3.1 node-fetch: undefined () node-html-parser: undefined () ora: undefined () os-browserify: undefined () p-limit: undefined () path-browserify: undefined () postcss: ^8.4.19 => 8.4.19 (8.4.14) postcss-flexbugs-fixes: undefined () postcss-modules-extract-imports: undefined () postcss-modules-local-by-default: undefined () postcss-modules-scope: undefined () postcss-modules-values: undefined () postcss-preset-env: undefined () postcss-safe-parser: undefined () postcss-scss: undefined () postcss-value-parser: undefined () process: undefined () punycode: undefined () querystring-es3: undefined () raw-body: undefined () react: 17.0.2 => 17.0.2 (18.1.0) react-countdown: ^2.3.5 => 2.3.5 react-dom: 17.0.2 => 17.0.2 react-google-autocomplete: ^2.7.0 => 2.7.0 react-is: 17.0.2 react-multi-carousel: ^2.8.0 => 2.8.2 react-refresh: 0.12.0 react-responsive-carousel: ^3.2.22 => 3.2.23 react-scroll: ^1.8.5 => 1.8.8 react-server-dom-webpack: undefined () regenerator-runtime: 0.13.4 rooks: ^5.10.2 => 5.14.1 sass-loader: undefined () schema-utils: undefined () semver: undefined () send: undefined () setimmediate: undefined () source-map: undefined () stream-browserify: undefined () stream-http: undefined () string-hash: undefined () string_decoder: undefined () strip-ansi: undefined () stripe: ^11.1.0 => 11.1.0 swiper: ^8.4.5 => 8.4.5 swiper_angular: 0.0.1 swr: ^1.2.2 => 1.3.0 swr-immutable: 0.0.1 swr-infinite: 0.0.1 tailwindcss: ^3.2.4 => 3.2.4 tar: undefined () terser: undefined () text-table: undefined () timers-browserify: undefined () tty-browserify: undefined () ua-parser-js: undefined () unistore: undefined () util: undefined () uuid: ^9.0.0 => 9.0.0 (3.4.0, 3.3.2, 8.3.2) vm-browserify: undefined () watchpack: undefined () web-vitals: undefined () webpack: undefined () webpack-sources: undefined () ws: undefined () npmGlobalPackages: aws-cdk: 2.50.0 corepack: 0.10.0 npm-upgrade: 3.1.0 npm: 8.19.1 ```

Describe the bug

I migrated to Next.js 12 using the button in the console. My 'dev' branch deployed automatically after migration and it is working as expected without any errors or issues.

When I tried upgrading my 'main' branch by merging a PR, I got the following error at the start of "Starting SSR Build"

Expected behavior

Build working as expected and deploying like it did on the other branch.

Reproduction steps

  1. Create PR and Merge it
  2. CI/CD started by amplify js on main branch

Code Snippet

// Put your code below this line.

Log output

``` // Put your logs below this line 2022-12-12T00:07:19.024Z [INFO]: λ (Server) server-side renders at runtime (uses getInitialProps or getServerSideProps) 2022-12-12T00:07:19.290Z [INFO]: Starting SSR Build... 2022-12-12T00:08:58.737Z [ERROR]: TypeError: Missing parameter name at 9 at lexer (/root/./-patch.2/node_modules/path-to-regexp/dist/index.js:48:23) at parse (/root/./-patch.2/node_modules/path-to-regexp/dist/index.js:98:18) at stringToRegexp (/root/./-patch.2/node_modules/path-to-regexp/dist/index.js:329:27) at Object.pathToRegexp (/root/./-patch.2/node_modules/path-to-regexp/dist/index.js:407:12) at Object.exports.default (/root/./-patch.2/node_modules/@sls-next/lambda-at-edge/dist/lib/pathToRegexStr.js:4:46) at /root/./-patch.2/node_modules/@sls-next/lambda-at-edge/dist/build.js:271:56 at Array.forEach () at Builder. (/root/./-patch.2/node_modules/@sls-next/lambda-at-edge/dist/build.js:240:43) at Generator.next () at fulfilled (/root/./-patch.2/node_modules/@sls-next/lambda-at-edge/dist/build.js:5:58)  2022-12-12T00:08:58.739Z [ERROR]: [?25h 67s › d2gzq6qw599ev8 › TypeError: Missing parameter name at 9 [?25h Terminating logging... ```

aws-exports.js

No response

Manual configuration

No response

Additional configuration

No response

Mobile Device

No response

Mobile Operating System

No response

Mobile Browser

No response

Mobile Browser Version

No response

Additional information and screenshots

No response

ghost commented 1 year ago

Hi @adeelejaz 👋🏽 did you try migrating the branch before merging a PR? Also, please provide your app ID so we can further investigate this error.

adeelejaz commented 1 year ago

Hi @hloriana, the merge was needed to get the changes in required for the deployment. Just to add context, the dev branch where the changes were first added, and then deployed to worked successfully. This is the second branch on the project.

App ID: d2gzq6qw599ev8

adeelejaz commented 1 year ago

So I fixed it, just for future reference for people who end up here...

I had to manually run the following command, because even though I ran through the migration through console, the app was still using WEB_DYNAMIC:

aws amplify update-app --region eu-west-1 --app-id <APP_ID> --platform  WEB_COMPUTE
github-actions[bot] commented 1 year ago

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.

github-actions[bot] commented 1 year ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.