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

custom server breaks during ssr prepass in 13.4 #49986

Closed
1 task done
juliusmarminge opened this issue May 18, 2023 · 4 comments
Closed
1 task done

custom server breaks during ssr prepass in 13.4 #49986

juliusmarminge opened this issue May 18, 2023 · 4 comments
Labels
bug Issue was opened via the bug report template.

Comments

@juliusmarminge
Copy link
Contributor

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:28 PST 2023; root:xnu-8796.101.5~3/RELEASE_ARM64_T6000
    Binaries:
      Node: 18.16.0
      npm: 9.5.1
      Yarn: N/A
      pnpm: 8.4.0
    Relevant packages:
      next: 13.4.0
      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)

No response

Link to the code that reproduces this issue

https://github.com/trpc/examples-next-prisma-websockets-starter

To Reproduce

  1. Clone repo.

  2. Run DB (change the port so that .env and docker-compose are synced) using docker compose up -d.

  3. Run a production build and start the preview: pnpm build && pnpm start

At this point, it should be working fine.

  1. Upgrade next to 13.4, and rerun the above commands: pnpm build && pnpm start.

You should now get a 500 error and something like this TypeError: Cannot read properties of null (reading 'useMemo').

See demo:

CleanShot.2023-05-18.at.12.27.22.mp4

Describe the Bug

When upgrading to 13.4, our websockets example suddenly started to 500, and getting some cannot access property of undefined errors when prepassing on the server.

I am really not sure what this issue boils down to, and I've tried making a more minimal repro without much luck... Not even sure if the issue is in Next, but since it got introduced when upgrading I'm starting out here.

Sorry if this is hard to debug and boil down the root cause of... I wish I could provide a more minimal repro...

Expected Behavior

Server not to 500 - just as it does pre-13.4

Which browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

@juliusmarminge juliusmarminge added the bug Issue was opened via the bug report template. label May 18, 2023
@juliusmarminge
Copy link
Contributor Author

juliusmarminge commented May 18, 2023

UPDATE:

Here's a bit more minimal example: https://github.com/juliusmarminge/custom-server-repro

You can turn off the ssr-prepass by toggling this boolean:

https://github.com/juliusmarminge/custom-server-repro/blob/762c53f786ede992ce67471620cc218f72240a67/src/utils/api.ts#L75

and with it off the server doesn't crash on a 500 in production mode.

So yea, might not next specific but it still only breaks in ^13.4 so it must come from some change you guys made, right?

UPDATE 2:

I've now boiled the issue down to 13.3.5-canary.12 and this PR: #49088. Server still works in 13.3.5-canary.11 without crashing. Explicitely disabling appDir fixes the issue.

@shuding
Copy link
Member

shuding commented May 19, 2023

Could you try the latest canary? I'm wondering if it's fixed with recent changes.

@juliusmarminge
Copy link
Contributor Author

Could you try the latest canary? I'm wondering if it's fixed with recent changes.

Yep. Works in 13.4.3. Thanks :)

@github-actions
Copy link
Contributor

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 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template.
Projects
None yet
Development

No branches or pull requests

2 participants