-
Notifications
You must be signed in to change notification settings - Fork 48
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
feat: Added h3 server handler to @ingest/h3. #310
Conversation
🦋 Changeset detectedLatest commit: 33687b8 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 |
cc @pi0 Just pinging you here, because usage of the
Due to this line here: https://github.com/unjs/h3/blob/12ccb81432a62783fe951a8170976c8162bce44a/src/utils/request.ts#L129 Do you want me to add an issue to https://github.com/unjs/h3 ? |
Hi. Haven’t tried locally but are you somehow mocking request and response objects passed to h3 habdler? Regardless feel free to directly open a pr for h3 to make req.connection?. Check optional |
@pi0 Cool. MR here for you when ready: unjs/h3#532 |
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 is great! Thanks for the MR, @michealroberts!
One mini change to some tests and we can get this in. Even has a changeset already! 😍
942ac7f
to
aa72baa
Compare
feat: Added h3 server handler to @ingest/h3.
aa72baa
to
cb5bfb9
Compare
@michealroberts I pushed a quick change to ensure handlers are still reported correctly for the benefit of the UI. It's a touch ugly, but this is changing soon anyway. Could I grab an example for you for a typical short h3 setup? I'll add an example to the Serving the Inngest API docs. 🙂 |
Cool, yeh I will add an example. It's exactly like Nuxt, but it can be a tad esoteric to know. This would also support nitro as well, which Nuxt is built on. Kind of like turtles all the way down. Nuxt 3 > Nitro > h3 |
@michealroberts Just a quick snippet is fine 🙂 Would something like this be reasonable? import { createApp, eventHandler } from "h3";
import { serve } from "inngest/h3";
const app = createApp();
app.use(
"/api/inngest",
eventHandler(serve(...)),
); |
@jpwilliams Yaeh, exactly that! Do you want the same again, but for nitro? https://nitro.unjs.io/ |
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@2.7.0 ### Minor Changes - [#313](#313) [`32c34b3`](32c34b3) Thanks [@jpwilliams](https://github.com/jpwilliams)! - Add ability to declare and send events without payloads, e.g. `inngest.send({ name: "my.event" });` - [#310](#310) [`696c411`](696c411) Thanks [@michealroberts](https://github.com/michealroberts)! - Added h3 framework server handler ### Patch Changes - [#319](#319) [`71b7d26`](71b7d26) Thanks [@jpwilliams](https://github.com/jpwilliams)! - Add ESM exports to `inngest` package to avoid extension imports Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Summary
Added h3 server handler to @ingest/h3.
h3 is the unjs project which is the foundation for the Nuxt 3 server
eventHandlers
.This MR provides backwards compatibility between Nuxt and h3, and can also be used within a nitro server setup too.
Includes bumping h3 to the latest version (v1.8.1).
Checklist