-
Notifications
You must be signed in to change notification settings - Fork 35
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 "inngest/hono"
serve handler not parsing environment variables
#571
Conversation
🦋 Changeset detectedLatest commit: f1d8ad8 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 |
queryString: (key) => c.req.query(key), | ||
headers: (key) => c.req.header(key), | ||
method: () => c.req.method, | ||
body: () => c.req.json(), | ||
env: () => c.env as Env, |
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.
This should stop folks needing to manually specifying signing/event keys.
@@ -4,7 +4,8 @@ | |||
"deploy": "wrangler deploy --minify src/index.ts" | |||
}, | |||
"dependencies": { | |||
"hono": "^4.2.7" | |||
"hono": "^4.2.7", | |||
"inngest": "^3.0.0" |
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.
The example didn't include inngest
🫠
A user has added the prerelease/inngest label, so this PR will be published to npm with the tag You can install this prerelease version with: npm install inngest@pr-571 The last release was built and published from f1d8ad8. |
@@ -35,11 +36,52 @@ export const serve = (options: ServeHandlerOptions) => { | |||
transformResponse: ({ headers, status, body }) => { | |||
return c.body(body, { headers, status }); | |||
}, | |||
url: () => new URL(c.req.url, c.req.header("host")), | |||
url: () => { |
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.
Would canParse
help here? it's safe to use becasue anyone using Hono would be using a runtime that supports it. https://developer.mozilla.org/en-US/docs/Web/API/URL/canParse_static
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.
Ah, awesome. Aye, at a glance it looks like Hono supports 18+. Thanks!
This reverts commit 7455268. Hono only supports environments that support `URL.canParse()`, but I'd rather not adjust our runtime tests per handler, so am keeping this verbose for Node 14-16 support.
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## inngest@3.19.4 ### Patch Changes - [#571](#571) [`67ca3aa`](67ca3aa) Thanks [@jpwilliams](https://github.com/jpwilliams)! - Fix `"inngest/hono"` serve handler not handling relative and absolute `req.url` - [#571](#571) [`67ca3aa`](67ca3aa) Thanks [@jpwilliams](https://github.com/jpwilliams)! - Fix `"inngest/hono"` serve handler not parsing environment variables Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Summary
The
"inngest/hono"
serve handler was not fetching environment variables, which are not reliably accessible via globals in common environments such as Cloudflare Workers.In addition,
url
handling was a little wonky and didn't seem to handle many variants. The hope was that Hono handled that to ensure thatc.req.url
is always/never absolute, but this doesn't seem to be the case.Checklist
Added a docs PR that references this PRN/AAdded unit/integration testsN/ARelated