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.js v12.0.8 - Nx executor seem to run Next in a custom server #8605

Closed
danr-za opened this issue Jan 20, 2022 · 7 comments · Fixed by #10103
Closed

Next.js v12.0.8 - Nx executor seem to run Next in a custom server #8605

danr-za opened this issue Jan 20, 2022 · 7 comments · Fixed by #10103
Assignees
Labels
outdated scope: nextjs Issues related to NextJS support for Nx type: bug

Comments

@danr-za
Copy link
Contributor

danr-za commented Jan 20, 2022

Current 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 - vercel/next.js#33450

Expected Behavior

Should use Next's server as is.

Steps to Reproduce

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
@vsavkin vsavkin added the scope: nextjs Issues related to NextJS support for Nx label Jan 20, 2022
@danr-za
Copy link
Contributor Author

danr-za commented Jan 27, 2022

Hey guys, any plans on this? It breaks the app

@babie
Copy link

babie commented Jan 30, 2022

FYI:

DOS Vulnerability for self-hosted next.js apps using i18n
GHSA-wr66-vrwm-5g5x

@rlenoir-codepoint
Copy link

rlenoir-codepoint commented Feb 1, 2022

Hi, I am also getting this error message when using Nx 13.7.1 and Next 12.0.9.

@jfabraxas
Copy link

I had the same issue.
As a workaround you can add the port and hostname to workspace.json,
worked for me

{
   "app": {
      "serve": {
         "builder": "@nrwl/next:server",
         "options": {
            "port": 4200,
            "hostname": "localhost"
         }
      }
   }
}

@jaysoo
Copy link
Member

jaysoo commented May 2, 2022

It looks like it's fixed in the newest version of nextjs (12.1.5). I'm also updating our defaults so host and port will be localhost and 4200 respectively, unless you override them. (#10103)

@jaysoo
Copy link
Member

jaysoo commented May 2, 2022

If you are still experiencing issues, please make sure you are on the latest supported nx version (13.10 and 14.0 as of this writing), and nextjs is also the latest.

@jaysoo jaysoo closed this as completed May 2, 2022
@github-actions
Copy link

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated scope: nextjs Issues related to NextJS support for Nx type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants