Loading...
Loading...
Use when upgrading an existing TypeScript codebase from Inngest SDK v3 to v4, or when fixing mixed v3/v4 API usage. Covers detecting current SDK usage, moving triggers into createFunction options, replacing EventSchemas with eventType/staticSchema, moving serve options to the client, updating realtime imports, rewriting step.invoke string IDs, checkpointing/serverless runtime settings, Connect option changes, and verification.
npx skill4agent add inngest/inngest-skills inngest-v3-v4-migrationstep.invoke@inngest/realtimeinngest@4inngest-brownfield-auditrg -n '"inngest"|"@inngest/realtime"|"@inngest/agent-kit"' package.json **/package.json
rg -n 'new Inngest|EventSchemas|eventType|staticSchema|createFunction\\(|serve\\(|connect\\(|step\\.invoke|referenceFunction|@inngest/realtime|realtimeMiddleware|useInngestSubscription|serveHost|rewriteGatewayEndpoint|logLevel|streaming:|signingKey|signingKeyFallback|baseUrl|INNGEST_DEV|INNGEST_SIGNING_KEY' .inngest-setupmaxRuntimestep.invokeInngest migration scan:
- Current package versions:
- Client files:
- Serve/connect entrypoints:
- Functions using old trigger syntax:
- EventSchemas usage:
- Realtime v3 package usage:
- step.invoke string IDs:
- Serverless runtime constraints:
- Tests/checks available:createFunctionEventSchemaseventType()staticSchema()step.invoke()@inngest/realtimenpm install inngest@latest
# or pnpm add inngest@latest
# or yarn add inngest@latest@inngest/realtimeinngestinngest/realtimeinngest/reactstep.realtimeinngest.realtimeINNGEST_DEV=1 npm run devisDev: trueINNGEST_SIGNING_KEYsigningKeysigningKeyFallbackbaseUrlnew Inngest(...)serve(...)// Old v3
app.use(
"/api/inngest",
serve({
client: inngest,
functions,
signingKey: process.env.INNGEST_SIGNING_KEY,
baseUrl: process.env.INNGEST_BASE_URL,
})
);
// New v4
export const inngest = new Inngest({
id: "my-app",
signingKey: process.env.INNGEST_SIGNING_KEY,
baseUrl: process.env.INNGEST_BASE_URL,
});
app.use("/api/inngest", serve({ client: inngest, functions }));serveHostserveOriginstreaming: "force"streaming: truestreaming: "allow"streaming: truestreaming: falsefalselogLevelloggernew ConsoleLogger({ level })// Old v3
inngest.createFunction(
{ id: "send-welcome" },
{ event: "user/created" },
async ({ event, step }) => {}
);
// New v4
inngest.createFunction(
{ id: "send-welcome", triggers: [{ event: "user/created" }] },
async ({ event, step }) => {}
);inngest.createFunction(
{ id: "nightly-sync", triggers: [{ cron: "0 2 * * *" }] },
async ({ step }) => {}
);step.invokeEventSchemasimport { Inngest, eventType, staticSchema } from "inngest";
import { z } from "zod";
export const userCreated = eventType("user/created", {
schema: z.object({
userId: z.string(),
email: z.string().email(),
}),
});
type InvoicePaid = {
invoiceId: string;
customerId: string;
};
export const invoicePaid = eventType("billing/invoice.paid", {
schema: staticSchema<InvoicePaid>(),
});await inngest.send(userCreated.create({ userId, email }));
inngest.createFunction(
{ id: "on-user-created", triggers: [userCreated] },
async ({ event }) => {}
);
await step.waitForEvent("wait-for-invoice", {
event: invoicePaid,
timeout: "7d",
});staticSchemareferenceFunction()import { referenceFunction } from "inngest";
await step.invoke("run-report", {
function: referenceFunction({
appId: "analytics-app",
functionId: "generate-report",
}),
data: { reportId },
});await step.invoke("run-report", {
function: generateReport,
data: { reportId },
});@inngest/realtimepublish@inngest/realtimerealtimeMiddleware(){ publish }useInngestSubscription()inngest/realtimestep.realtime.publishinngest.realtime.publishstep.runinngest-realtimestep.realtime.publishstep.runinngest.realtime.publishPromise.racePromise.racegroup.parallel()maxRuntimeexport const inngest = new Inngest({
id: "my-app",
checkpointing: {
maxRuntime: "50s",
},
});rewriteGatewayEndpointgatewayUrlisolateExecution: falseINNGEST_CONNECT_ISOLATE_EXECUTION=falseINNGEST_DEV=1npx inngest-cli@latest devINNGEST_DEV=1INNGEST_SIGNING_KEYCls is not a constructor/api/inngest@inngest/realtimestep.invokereferenceFunction()EventSchemaseventType()staticSchema()Promise.racegroup.parallel()inngest@4signingKeybaseUrlsigningKeyFallbackserve()EventSchemasisDev: truestep.invoke