Skip to content

Instantly share code, notes, and snippets.

@djfarrelly
Created October 26, 2022 17:32
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save djfarrelly/815686ec6b837ffebf45456de8f99639 to your computer and use it in GitHub Desktop.
Save djfarrelly/815686ec6b837ffebf45456de8f99639 to your computer and use it in GitHub Desktop.
Inngest Cloudflare Workers Support (w/ inngest@v0.6.1)
import { createFunction } from "inngest"; // v0.6.1
import { serve } from "inngest/cloudflare";
/**
* Inngest serve requires "node_compat = true" to be set in your wrangler.toml
*
* Set INNGEST_SIGNING_KEY in your wrangler.toml environment variables.
* Get this key in your Inngest dashboard: https://app.inngest.com/secrets
*/
export interface Env {
PRODUCTION: string;
INNGEST_SIGNING_KEY: string;
}
const myFn = createFunction("Hello world", "demo/test.event", ({ event }) => {
return "Hello!";
});
export default {
async fetch(
request: Request,
env: Env,
ctx: ExecutionContext
): Promise<Response> {
return serve("My app", [myFn])({ request, env });
},
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment