-
Notifications
You must be signed in to change notification settings - Fork 38
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
fix(dev-server): Fix issue in dev-server where requestListener would return null #212
Conversation
🦋 Changeset detectedLatest commit: 4c9a223 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
wdyt @yusukebe ? |
Oh. I also just found this /~https://github.com/honojs/hono/pull/1142/files#diff-f42b11987a9538ff250a31ba4eb66ee557f7512860fae88c5020a83b5e97c28cR278 |
I verified that a brand new honox app created via create-hono-app x-basic crashes with |
a48c12a
to
4c9a223
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Hi @gobengo ! Good fix! I've added a test for it by myself. Looks good. I'll merge this and release a new version. Thank you for your contribution. |
Thanks!
You're welcome. my pleasure |
I was running into an error using honox, this vite dev server plugin, and hono node-server.
The error stack in prod is like
I believe that comes from the
cacheKey in res
here /~https://github.com/honojs/node-server/blob/590fe6cef8a795ea10c300033387f13ed31e144f/src/listener.ts#L86But that is downstream from calling requestListener to get a Promise.
Before this change, if the response from the router has
reuest.body === null
(e.g. a Response with status 404 and no response body), then the dev-server will return null here, not a response, and downstream things that expect a response (like node-server) will error.This change makes it so if the dev server is unable to inject script into response to build a new response (e.g. when there is no response.body at all), a response is still returned.