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

Prebundled React used in standalone server when appDir is enabled #49055

Closed
1 task done
Yovach opened this issue May 1, 2023 · 1 comment · Fixed by #49116
Closed
1 task done

Prebundled React used in standalone server when appDir is enabled #49055

Yovach opened this issue May 1, 2023 · 1 comment · Fixed by #49116
Assignees
Labels
area: app App directory (appDir: true) bug Issue was opened via the bug report template. Output (export/standalone) Related to the the output option in `next.config.js`.

Comments

@Yovach
Copy link
Contributor

Yovach commented May 1, 2023

Verify canary release

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

Provide environment information

Operating System:
  Platform: linux
  Arch: x64
  Version: #1 SMP Fri Jan 27 02:56:13 UTC 2023
Binaries:
  Node: 18.16.0
  npm: 9.6.5
  Yarn: N/A
  pnpm: N/A
Relevant packages:
  next: 13.3.5-canary.1
  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), Standalone mode (output: "standalone")

Link to the code that reproduces this issue

https://github.com/Yovach/next-standalone-trpc

To Reproduce

1- Clone
2- npm install
3- npm run dev
4- Go to localhost:3000
5- You should see TypeError: Cannot read properties of null (reading 'useState') in the console

Describe the Bug

Before Next.js 13.3.2, it was working correctly but after the update, we have an error server-side that says TypeError: Cannot read properties of null (reading 'useState').

As you can see, I enabled appDir and it's crashing but if this feature is disabled, the website is working properly.

It seems to be the same issue as #42588

Expected Behavior

The website should not showing any error with tRPC and Next.js 13.3.2

Which browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

@Yovach Yovach added the bug Issue was opened via the bug report template. label May 1, 2023
@github-actions github-actions bot added area: app App directory (appDir: true) Output (export/standalone) Related to the the output option in `next.config.js`. labels May 1, 2023
@shuding shuding self-assigned this May 1, 2023
@shuding shuding changed the title Cannot read properties of null (reading 'useState') Prebundled React used in standalone server when appDir is enabled May 1, 2023
shuding added a commit that referenced this issue May 4, 2023
Fixes #49055, fixes #48918. 

App dir will always require the server to run in the workers mode, so it
can keep a separate Node.js process for pages. This PR updates the
standalone server to initialize a "standalone server" (which works
similar to `start-server`), and changes the tracked files to include
Jest worker.
@github-actions
Copy link
Contributor

github-actions bot commented Jun 3, 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 3, 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) bug Issue was opened via the bug report template. Output (export/standalone) Related to the the output option in `next.config.js`.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants