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

Nuxt dev server with https is broken on Node 18+ #20435

Closed
Atinux opened this issue Apr 21, 2023 — with Volta.net · 5 comments
Closed

Nuxt dev server with https is broken on Node 18+ #20435

Atinux opened this issue Apr 21, 2023 — with Volta.net · 5 comments

Comments

Copy link
Member

Atinux commented Apr 21, 2023

Reproduction:

npx nuxi init@latest my-app
cd my-app
pnpm i
npx nuxi dev --https

CleanShot 2023-04-21 at 10.47.33@2x.png

I also notice that we don't support the devServer.https: true option, any reason for that?

@Atinux Atinux added the bug label Apr 21, 2023 — with Volta.net
@danielroe danielroe added the 3.x label Apr 21, 2023
Copy link
Member Author

Atinux commented Apr 21, 2023

Actually the devServer.https: true option works but display a TS error:
CleanShot 2023-04-21 at 10.54.39@2x.png

@sshwy
Copy link

sshwy commented Apr 21, 2023

facing the same bug

Copy link
Member

If you are experiencing this, you can downgrade to Node v16 or use legacy devBundler. For now, it seems that our SSL vite-node solution is not compatible with Node 18+ with native fetch.

export const viteNodeFetch = $fetch.create({
baseURL: viteNodeOptions.baseURL,
agent: viteNodeOptions.baseURL.startsWith('https://')
? new HTTPSAgent({ rejectUnauthorized: false })
: null
})

cc: @pi0

@danielroe danielroe changed the title Nuxt dev server with https is broken Nuxt dev server with https is broken on Node 18+ Apr 25, 2023
@danielroe
Copy link
Member

This is now working for me.

@pi0
Copy link
Member

pi0 commented Oct 23, 2023

Worth to mention, the final fix for this is that Nuxi CLI uses an internal http server + public https server which proxies to the internal one and vite dev server directly uses internal server.

In case of using --https --no-fork, we would need some Node.js flags to allow unauthorized keys (written in CLI output log)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants