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

with-http2 example throwing error | Also Next@^12.x.x is not working with http 2 #50270

Closed
1 task done
apurvaojas opened this issue May 24, 2023 · 2 comments · Fixed by #56768
Closed
1 task done

with-http2 example throwing error | Also Next@^12.x.x is not working with http 2 #50270

apurvaojas opened this issue May 24, 2023 · 2 comments · Fixed by #56768
Labels
examples Issue/PR related to examples locked

Comments

@apurvaojas
Copy link

Verify canary release

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

Provide environment information

Operating System:
      Platform: darwin
      Arch: x64
      Version: Darwin Kernel Version 22.4.0: Mon Mar  6 21:00:17 PST 2023; root:xnu-8796.101.5~3/RELEASE_X86_64
    Binaries:
      Node: 16.15.1
      npm: 8.11.0
      Yarn: 1.22.17
      pnpm: N/A
    Relevant packages:
      next: 13.4.4-canary.7
      eslint-config-next: N/A
      react: 18.2.0
      react-dom: 18.2.0
      typescript: N/A

Which example does this report relate to?

with-http2

What browser are you using? (if relevant)

Chrome 113.0.5672.126

How are you deploying your application? (if relevant)

No response

Describe the Bug

npm run dev                                                              

> dev
> node server.js

- event compiled client and server successfully in 1322 ms (158 modules)
- wait compiling...
Listening on HTTPS port 3000
- event compiled client and server successfully in 255 ms (158 modules)
- wait compiling / (client and server)...
- event compiled client and server successfully in 349 ms (189 modules)
- error unhandledRejection: TypeError: Cannot read properties of undefined (reading 'url')
    at renderToHTML (/Users/POC/with-http2-app/node_modules/next/dist/server/render.js:286:17)
    at DevServer.renderHTMLImpl (/Users/POC/with-http2-app/node_modules/next/dist/server/next-server.js:688:41)
    at /Users/POC/with-http2-app/node_modules/next/dist/server/next-server.js:675:105
    at NextTracerImpl.trace (/Users/POC/with-http2-app/node_modules/next/dist/server/lib/trace/tracer.js:86:20)
    at DevServer.renderHTML (/Users/POC/with-http2-app/node_modules/next/dist/server/next-server.js:675:41)
    at doRender (/Users/POC/with-http2-app/node_modules/next/dist/server/base-server.js:1031:45)
    at cacheEntry.responseCache.get.incrementalCache.incrementalCache (/Users/POC/with-http2-app/node_modules/next/dist/server/base-server.js:1162:34)
    at /Users/POC/with-http2-app/node_modules/next/dist/server/response-cache/index.js:99:42
    at ResponseCache.get (/Users/POC/with-http2-app/node_modules/next/dist/server/response-cache/index.js:149:11)
    at DevServer.renderToResponseWithComponentsImpl (/Users/POC/with-http2-app/node_modules/next/dist/server/base-server.js:1081:53)
    at /Users/POC/with-http2-app/node_modules/next/dist/server/base-server.js:710:121
    at NextTracerImpl.trace (/Users/POC/with-http2-app/node_modules/next/dist/server/lib/trace/tracer.js:86:20)
    at DevServer.renderToResponseWithComponents (/Users/POC/with-http2-app/node_modules/next/dist/server/base-server.js:710:41)
    at DevServer.renderPageComponent (/Users/POC/with-http2-app/node_modules/next/dist/server/base-server.js:1313:35)
    at async DevServer.renderToResponseImpl (/Users/POC/with-http2-app/node_modules/next/dist/server/base-server.js:1344:32)
    at async DevServer.pipeImpl (/Users/POC/with-http2-app/node_modules/next/dist/server/base-server.js:628:25) {
  page: '/'
}

Expected Behavior

NextJs Application should work with HTTP2.

To Reproduce

Follow the Steps Mentioned here
https://github.com/vercel/next.js/tree/canary/examples/with-http2

@apurvaojas apurvaojas added the examples Issue/PR related to examples label May 24, 2023
@apurvaojas apurvaojas changed the title with-http2 example throwing error with-http2 example throwing error | Also Next@^12.x.x is not working with http 2 May 25, 2023
@can-acar
Copy link

can-acar commented Sep 6, 2023

with-http2 example throwing error | Also Next@^13.x.x is not working. Error Detail:

TypeError: fetch failed at Object.fetch (node:internal/deps/undici/undici:11576:11) 
at async invokeRequest (D:\Projects\web\node_modules\next\dist\server\lib\server-ipc\invoke-request.js:17:12) 
at async invokeRender (D:\Projects\web\node_modules\next\dist\server\lib\router-server.js:254:29) 
at async handleRequest (D:\Projects\web\node_modules\next\dist\server\lib\router-server.js:447:24) 
at async NextCustomServer.requestHandler (D:\Projects\web\node_modules\next\dist\server\lib\router-server.js:464:13) 
at async NextCustomServer.render (D:\Projects\web\node_modules\next\dist\server\next.js:269:9) 
{cause: InvalidArgumentError: invalid header key\n at processHeader (D:\Projects\web\node_modules\n…, stack: "TypeError: fetch failed\n at Object.fetch (node:…-web\node_modules\next\dist\server\next.js:269:9)", message: "fetch failed"}
requestHandler           	router-server.js:473
Async call from await
render                   	next.js:269
(anonymous function)     	index.js:57
emit                     	events.js:514
onServerStream           	compat:916
emit                     	events.js:514
sessionOnStream          	core:3011
emit                     	events.js:514
emit                     	core:331
processTicksAndRejections	task_queues:85
Async call from TickObject
init                     	inspector_async_hook:25
emitInitNative           	async_hooks.js:202
emitInitScript           	async_hooks.js:505
nextTick                 	task_queues:132
onSessionHeaders         	core:387
callbackTrampoline       	async_hooks.js:130
Async call from HTTP2SESSION
init                     	inspector_async_hook:25
emitInitNative           	async_hooks.js:202
setupHandle              	core:1032
Http2Session             	core:1270
ServerHttp2Session       	core:1620
connectionListener       	core:3079
emit                     	events.js:514
onServerSocketSecure     	_tls_wrap:1150
emit                     	events.js:514
TLSSocket._finishInit    	_tls_wrap:1038
onhandshakedone          	_tls_wrap:170
callbackTrampoline       	async_hooks.js:130
Async call from TLSWRAP
init                     	inspector_async_hook:25
emitInitNative           	async_hooks.js:202
TLSSocket._wrapHandle    	_tls_wrap:666
TLSSocket                	_tls_wrap:566
tlsConnectionListener    	_tls_wrap:1181
emit                     	events.js:514
onconnection             	net:2157
callbackTrampoline       	async_hooks.js:130


@kodiakhq kodiakhq bot closed this as completed in #56768 Oct 13, 2023
kodiakhq bot pushed a commit that referenced this issue Oct 13, 2023
### What?

If the custom server uses `app.render(xxx)` will render the normal js files as server components in dev mode and cause 404 error when loading every non-HTML file.

### How?

Fixes nodejs/help#4253, fixes #50270
@github-actions
Copy link
Contributor

This closed issue has been automatically locked because it had no new activity for 2 weeks. 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 Oct 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
examples Issue/PR related to examples locked
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants