-
Notifications
You must be signed in to change notification settings - Fork 27.3k
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
server crashes on page load using custom server with compression #8408
Comments
Related: the docs are slightly off. The option to disable compression is named |
Would love to see this, my only lighthouse score reduction is due to non http2 ;) |
There's a deeper problem beneath the surface here. Currently next-server expects the req to be http.IncomingMessage, not a http2.Http2ServerRequest. As soon as you try to convert the project to typescript, you see this problem. (Also see #8625.) This means that you might be able to get the project to run, you might run into unknown future problems because your code or other code in your stack are making incorrect assumptions about what the request object is that it's working with. I think the fix to this is going to require some re-work across all the next-server methods, but I could be wrong. One solution would be for next-server to not use http objects directly as parameters, but instead use an or object that only has the properties/methods that next wants to back. That interface/object would contain a reference to the raw request, whether its http.IncomingMessage or http2.Http2ServerRequest. This would be a breaking affect the method signature of many next-server methods, and it would be a breaking change. |
Closing this as it's upstream in the compression package and it relies on the custom server api to be implemented. |
This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Bug report
Describe the bug
When using a custom server (e.g. Node's native
http2
), the server crashes after loading the first page. Error output is:To Reproduce
npx create-next-app --example with-http2 with-http2-app
cd with-http2-app
localhost-privkey.pem
andlocalhost-cert.pem
.npm run dev
https://localhost:3000/
in a browser and ignore the warning about self-signed certs.I don't believe that this bug is limited to the example... but it's a good way to reproduce the issue. See "Additional context" for details.
Expected behavior
The server should stay up after responding.
System information
OS
: Ubuntu 18.04.3 LTS.Node
: I reproduced this on bothv11.15.0
andv8.16.1
.Next.js
: v9.0.3Additional context
Probably caused by: expressjs/compression#128
Probably introduced by: #8066
You can fix it by disabling compression:
The text was updated successfully, but these errors were encountered: