Next.js v12.0.8 - Nx executor seem to run Next in a custom server
See original GitHub issueCurrent Behavior
Seems like Next.js identifies the server nx’s executor is using as a custom server.
More details on my original ticket in next’s repo - https://github.com/vercel/next.js/issues/33450
Expected Behavior
Should use Next’s server as is.
Steps to Reproduce
- Create a repo with Next.js app
- Update Next.js to v12.0.8
- Add middleware as described here - https://github.com/vercel/next.js/issues/33450
This issue may not be prioritized if details are not provided to help us reproduce the issue.
Failure Logs
Error: To use middleware you must provide a `hostname` and `port` to the Next.js Server
Environment
Node : 16.13.0
OS : darwin x64
yarn : 3.1.0
nx : 13.4.6
@nrwl/angular : undefined
@nrwl/cli : 13.4.6
@nrwl/cypress : 13.4.6
@nrwl/devkit : 13.4.6
@nrwl/eslint-plugin-nx : 13.4.6
@nrwl/express : undefined
@nrwl/jest : 13.4.6
@nrwl/linter : 13.4.6
@nrwl/nest : undefined
@nrwl/next : 13.4.5
@nrwl/node : 13.4.6
@nrwl/nx-cloud : undefined
@nrwl/react : 13.4.6
@nrwl/react-native : undefined
@nrwl/schematics : undefined
@nrwl/tao : 13.4.6
@nrwl/web : 13.4.6
@nrwl/workspace : 13.4.6
@nrwl/storybook : 13.4.6
@nrwl/gatsby : undefined
typescript : 4.5.4
rxjs : 6.6.7
---------------------------------------
Community plugins:
nx-stylelint: 13.1.0
Issue Analytics
- State:
- Created 2 years ago
- Reactions:11
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Advanced Features: Custom Server - Next.js
A custom Next.js server allows you to start a server 100% programmatically in order to use custom server patterns. Most of the time,...
Read more >@nrwl/next:custom-server | Nx
Add a custom server to existing Next.js application. ... By default, Nx will search for custom-server in the default collection provisioned in ...
Read more >Env vars are undefined in Nextjs v12.0.8 - Stack Overflow
TEST (test env var) but I'm getting undefined . It seems process.env is always empty. I restarted the server but I still don't...
Read more >Hot Reload MDX changes in Next.js and Nx
A custom server is basically a function with a certain signature that we register on our Nx Next.js executor. The file itself can...
Read more >Nx Office Hours: Building your website with Next.js - YouTube
Brandon Roberts is joined by fellow Nrwlian Juri Strumpflohner to discuss his ongoing blog series on building websites with Next. js, ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I had the same issue. As a workaround you can add the port and hostname to workspace.json, worked for me
FYI:
DOS Vulnerability for self-hosted next.js apps using i18n https://github.com/vercel/next.js/security/advisories/GHSA-wr66-vrwm-5g5x