Ship Background Jobs, Crons, Webhooks, and Reliable Workflows in record time with Inngest and RedwoodJS

Inngest is an open source platform that adds superpowers to serverless functions.

You can implement background jobs, delayed jobs, scheduled (aka cron) jobs, step functions and even fan-outs quickly and reliably.

We’ve added super-easy Inngest configuration to Redwood experiments.

rw experimental setup-inngest 

Note: your project needs to use at least version 5.0.7 or newer or a recent canary release.

This command uses inngest-setup-redwoodjs to setup Inngest for background, scheduled, delayed, multi-step, and fan-out jobs:

:heavy_check_mark: Adding Inngest setup packages for RedwoodJS …
:heavy_check_mark: Install inngest packages …
:heavy_check_mark: Configure inngest …
:heavy_check_mark: Add the Inngest GraphQL plugin …
:heavy_check_mark: Add inngest helloWorld example …
:heavy_check_mark: Modify the GraphQL handler to the useInngest plugin …
:heavy_check_mark: Add inngest dev script to package.json
:heavy_check_mark: Adding config to redwood.toml…

Once configured, please see what is added, where and why and your next steps.

The above docs will show how to can run the Inngest Dev Server and start building event-driven workflows.

Creating Functions

Use

yarn inngest-setup-redwoodjs function <name>

to create background, scheduled, delayed and other Inngest function types.

You will be prompted for the function type.

Auto-Instrumented GraphQL API

The philosophy is to:

  • “instrument everything” by sending events for each GraphQL execution result to Inngest to effortlessly build event-driven applications.
  • provide fine-grained control over what events are sent such as operations (queries, mutations, or subscriptions), introspection events, when GraphQL errors occur, if result data should be included, type and schema coordinate denylists … and more.
  • be customized with event prefix, name and user context functions

This experimental plugin feature will instrus=ment your api to send events which you can later use in you workflows and jobs.

The function command can ge used with:

yarn inngest-setup-redwoodjs function <name> --graphql

And you will be given a list of queries and mutations to use when creating your function. The event name will be based on the GraphQL operation for consistent conventions.

Feedback

Please do provide feedback on this experimental command as well as the plugin and function commands.

More Info

6 Likes

Thanks for spending the time, it works perfectly, and the local DX with Inngest is above my expectations! I love the “replay” option. Perfect timing as I had the goal to have background/cron working this weekend, and this post just made it easy in a few hours. Thank you and I will provide feedback when I test this on Netlify too!

1 Like

Thanks. Inngest recently released v2 of their SDK and I plan to update this plugin soon.

More info: Upgrading from Inngest SDK v1 to v2 - Inngest Documentation

Here’s a different approach, but one, that works outside of the cloud too.

Btw the plug-in has been updated to use v2

Thank you, DT! I just deployed to my staging with the netlify-plugin-inngest and it’s working great!

2 Likes

Just came to say thanks for this @dthyresson , I got some scheduled emails sending in no time, appreciate the work :pray:

1 Like

Nice! More email and mailer support is planned for the next epoch release. Just met with Resend https://resend.com/ and we’ll have a quick start up this week.

Their react-email makes it super easy to generate rich emails: https://react.email/

It works current with just a small change to the api side tsconfig compile options: “jsx”: “react”,

2 Likes

Is there a way to update the Inngest package to v3? If I’m not mistaken, currently RedwoodJS will install 2.0.2 and the latest Inngest is v3.6.2 (quite a bit behind); and there are important features in the new library that we’d want to rely on!

2 Likes

Are there any plans to update this to the latest version of Inngest? Issue raised at Out of date Inngest · Issue #190 · inngest/envelop-plugin-inngest · GitHub

Hi @oreid are they plans - short answer; yes. I just have not been able to get to updates giving work on RedwoodJS v7.

That said, there is no reason you cannot simply install the latest inngest package and using it in your API.

The plugin adds some friendly helpers to enrich your GraphQL AP with some events – the instrumentation: Instrumenting GraphQL - Inngest Documentation, but you can just define and implement your own in the services.

You should be able to simply follow this guide: Serving the Inngest API - Inngest Documentation

Thanks for the update @dthyresson. Totally understandable. Congratulations on the v7 release!