-
Notifications
You must be signed in to change notification settings - Fork 27.8k
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
Hapi example broken: inconsistent server promises #1170
Comments
Sounds good. Apologize for merging a bad example. My knowledge of Hapi is limited |
@finneganh I added you as a collaborator in case you want to own all the Hapi-related PRs |
I'm not much of an expert but I'm willing to take a look at them. |
fionawhim
pushed a commit
to fionawhim/next.js
that referenced
this issue
Feb 16, 2017
The change in vercel#1155 to remove server-side gzipping changed static rendering to no longer return a promise, which broke the Hapi example that was waiting for a resolved promise before closing the request. This PR fixes up all render or serve methods of server.js to consistently either await or return. Additionally, it collapses serveStatic and _serveStatic, as _serveStatic no longer needs to be factored out.
fionawhim
pushed a commit
to fionawhim/next.js
that referenced
this issue
Feb 16, 2017
The change in vercel#1155 to remove server-side gzipping changed static rendering to no longer return a promise, which broke the Hapi example that was waiting for a resolved promise before closing the request. This PR fixes up all render or serve methods of server.js to consistently either await and/or return. Additionally, it collapses serveStatic and _serveStatic, as _serveStatic no longer needs to be factored out.
rauchg
pushed a commit
that referenced
this issue
Feb 16, 2017
The change in #1155 to remove server-side gzipping changed static rendering to no longer return a promise, which broke the Hapi example that was waiting for a resolved promise before closing the request. This PR fixes up all render or serve methods of server.js to consistently either await and/or return. Additionally, it collapses serveStatic and _serveStatic, as _serveStatic no longer needs to be factored out.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
It looks like #1099 left Hapi in a broken state with main.js and common.js modules. The various
render*
methods in server/index.js are inconsistent about whether they return a promise, so what’s happening now is that thedefaultHandlerWrapper
is closing the response before therenderStatic
method actually renders anything, since it returnsvoid
without anyawait
.Note the ”Content-Length: 0“

My proposed fix for this, which I can put a PR together for, is to make sure (and document and/or test) that all the methods of
Server
are consistently returning promises that don’t resolve until they have written their complete output.The text was updated successfully, but these errors were encountered: