Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NEXT-1101] Regression using nested routes with params #49193

Closed
1 task done
tommybarvaag opened this issue May 4, 2023 · 9 comments
Closed
1 task done

[NEXT-1101] Regression using nested routes with params #49193

tommybarvaag opened this issue May 4, 2023 · 9 comments
Labels
area: app App directory (appDir: true)

Comments

@tommybarvaag
Copy link

tommybarvaag commented May 4, 2023

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
      Platform: darwin
      Arch: arm64
      Version: Darwin Kernel Version 22.4.0: Mon Mar  6 20:59:58 PST 2023; root:xnu-8796.101.5~3/RELEASE_ARM64_T6020
    Binaries:
      Node: 18.15.0
      npm: 9.5.0
      Yarn: 1.22.19
      pnpm: 8.4.0
    Relevant packages:
      next: 13.3.5-canary.8
      eslint-config-next: 13.3.4
      react: 18.2.0
      react-dom: 18.2.0

Which area(s) of Next.js are affected? (leave empty if unsure)

App directory (appDir: true)

Link to the code that reproduces this issue

https://github.com/tommybarvaag/nested-routes-with-params

To Reproduce

Everything works as expected locally with next dev but crashes when hosted @vercel.

Click the link Go to second params page on the page https://nested-routes-with-params.vercel.app.

This crashes the page. Resulting in a blank render.

If we peek into the console you can see the following error
image

On further inspection in Vercel logs we can read the following

TypeError: Cannot read properties of undefined (reading 'first')
    at (node_modules/.pnpm/next@13.3.4_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/esm/server/app-render/app-render.js:174:0)
    at (node_modules/.pnpm/next@13.3.4_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/esm/server/app-render/app-render.js:450:0)
    at (node_modules/.pnpm/next@13.3.4_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/esm/server/app-render/app-render.js:441:0)
    at (node_modules/.pnpm/next@13.3.4_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/esm/server/app-render/app-render.js:477:75)
    at (node_modules/.pnpm/next@13.3.4_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/esm/server/app-render/app-render.js:441:0)
    at (node_modules/.pnpm/next@13.3.4_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/esm/server/app-render/app-render.js:759:57)

And

TypeError: Cannot read properties of null (reading 'default')
    at (node_modules/.pnpm/next@13.3.4_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/esm/build/webpack/loaders/next-edge-ssr-loader/render.js:65:0)
    at (node_modules/.pnpm/next@13.3.4_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/esm/server/web-server.js:349:0)
    at (node_modules/.pnpm/next@13.3.4_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/esm/server/base-server.js:1413:0)
    at (node_modules/.pnpm/next@13.3.4_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/esm/server/base-server.js:1311:0)
    at (node_modules/.pnpm/next@13.3.4_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/esm/server/base-server.js:563:0)
    at (node_modules/.pnpm/next@13.3.4_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/esm/server/web-server.js:258:0)
    at (node_modules/.pnpm/next@13.3.4_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/esm/server/router.js:294:0)
    at (node_modules/.pnpm/next@13.3.4_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/esm/server/base-server.js:537:0)

And

 Error: An error occurred in the Server Components render. The specific message is omitted in production builds to avoid leaking sensitive details. A digest property is included on this error instance which may provide additional details about the nature of the error. {
  digest: '951169804'
}

Describe the Bug

Next crashes with nesting routes with params.

The reproduction repo contains the following route structure

├── app
│   ├── layout.tsx
│   └── page.tsx
│   └── first
│   │   ├── [first]
│   │   │   ├── page.tsx
│   │   │   └── second
│   │   │   │   ├── [second]
│   │   │   │   │   ├── page.tsx

When navigating to the [second] page Next will throw an error because the first parameter is undefined.

Expected Behavior

Shouldn't crash.

Which browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

Vercel

NEXT-1101

@tommybarvaag tommybarvaag added the bug Issue was opened via the bug report template. label May 4, 2023
@github-actions github-actions bot added the area: app App directory (appDir: true) label May 4, 2023
@hansottowirtz
Copy link

We're also seeing this error since upgrading from 13.3.1-canary.4 to higher.

Seems like params is not defined here:

const pathParams = (renderOpts as any).params as ParsedUrlQuery

@tommybarvaag
Copy link
Author

Tested with latest canary 13.4.1-canary.1 and this still fails @vercel but works locally.

Operating System:
      Platform: darwin
      Arch: arm64
      Version: Darwin Kernel Version 22.4.0: Mon Mar  6 20:59:58 PST 2023; root:xnu-8796.101.5~3/RELEASE_ARM64_T6020
    Binaries:
      Node: 18.15.0
      npm: 9.5.0
      Yarn: 1.22.19
      pnpm: 8.4.0
    Relevant packages:
      next: 13.4.1-canary.1
      eslint-config-next: 13.4.0
      react: 18.2.0
      react-dom: 18.2.0

@huozhi
Copy link
Member

huozhi commented May 6, 2023

Does latest version 13.4.1 fix your issue?

@hansottowirtz
Copy link

@huozhi No, still the same error.

@huozhi huozhi added kind: bug and removed bug Issue was opened via the bug report template. labels May 6, 2023
@huozhi huozhi changed the title Regression using nested routes with params [NEXT-1101] Regression using nested routes with params May 6, 2023
@tommybarvaag
Copy link
Author

@huozhi Upgraded the reproduction site to 13.4.1 and it still gives the same error.

https://nested-routes-with-params.vercel.app

@huozhi
Copy link
Member

huozhi commented May 8, 2023

We can repro now, I've marked it as a bug and we're investigating now 🙏

@tommybarvaag
Copy link
Author

@huozhi I updated the repro to 13.4.2-canary.2 and the page with nested params is now working.

@timneutkens
Copy link
Member

Should be fixed by #49315 indeed 👍 Thanks for checking!

@github-actions
Copy link
Contributor

github-actions bot commented Jun 8, 2023

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: app App directory (appDir: true)
Projects
None yet
Development

No branches or pull requests

4 participants