$npx -y skills add inngest/inngest-skills --skill inngest-v3-v4-migrationUse 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 cli
| 1 | # Inngest v3 to v4 Migration |
| 2 | |
| 3 | Use this skill when the user asks to upgrade Inngest, fix v3/v4 errors, migrate |
| 4 | realtime, or clean up a codebase that has mixed SDK patterns. |
| 5 | |
| 6 | Primary reference: |
| 7 | https://www.inngest.com/docs/reference/typescript/v4/migrations/v3-to-v4 |
| 8 | |
| 9 | This skill is agent-first: detect actual usage first, make mechanical API |
| 10 | changes in a controlled order, then typecheck and run focused tests. |
| 11 | |
| 12 | ## When to Trigger |
| 13 | |
| 14 | Use this skill for requests like: |
| 15 | |
| 16 | - "Upgrade Inngest from v3 to v4" |
| 17 | - "Fix our Inngest v4 migration" |
| 18 | - "We're getting signing key required / cloud mode errors after upgrading" |
| 19 | - "`step.invoke` with a string function ID stopped working" |
| 20 | - "`@inngest/realtime` broke after installing `inngest@4`" |
| 21 | - "Move from EventSchemas to eventType" |
| 22 | - "Make this existing Inngest repo v4-compatible" |
| 23 | |
| 24 | If the user asks for a broad codebase reliability audit first, use |
| 25 | `inngest-brownfield-audit` to choose scope, then return here for the v4 changes. |
| 26 | |
| 27 | ## Migration Scan |
| 28 | |
| 29 | Start by locating all Inngest surfaces: |
| 30 | |
| 31 | ```bash |
| 32 | rg -n '"inngest"|"@inngest/realtime"|"@inngest/agent-kit"' package.json **/package.json |
| 33 | 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' . |
| 34 | ``` |
| 35 | |
| 36 | Then classify the repo: |
| 37 | |
| 38 | - **No Inngest yet:** use `inngest-setup`, not this migration skill. |
| 39 | - **v3 only:** migrate the SDK and all breaking changes together. |
| 40 | - **mixed v3/v4:** prioritize removing broken v3 APIs from v4 code. |
| 41 | - **v4 mostly done:** focus on missed runtime gotchas like local dev mode, |
| 42 | serverless `maxRuntime`, realtime package imports, and string `step.invoke`. |
| 43 | |
| 44 | Before editing, record: |
| 45 | |
| 46 | ```text |
| 47 | Inngest migration scan: |
| 48 | - Current package versions: |
| 49 | - Client files: |
| 50 | - Serve/connect entrypoints: |
| 51 | - Functions using old trigger syntax: |
| 52 | - EventSchemas usage: |
| 53 | - Realtime v3 package usage: |
| 54 | - step.invoke string IDs: |
| 55 | - Serverless runtime constraints: |
| 56 | - Tests/checks available: |
| 57 | ``` |
| 58 | |
| 59 | ## Upgrade Order |
| 60 | |
| 61 | 1. Update package versions. |
| 62 | 2. Fix client construction and local/prod mode. |
| 63 | 3. Move serve options to the client. |
| 64 | 4. Move triggers into `createFunction` options. |
| 65 | 5. Replace `EventSchemas` with `eventType()` / `staticSchema()`. |
| 66 | 6. Rewrite `step.invoke()` string IDs. |
| 67 | 7. Migrate realtime from `@inngest/realtime` to v4 native APIs. |
| 68 | 8. Update middleware and logging. |
| 69 | 9. Configure checkpointing/serverless runtime. |
| 70 | 10. Typecheck, run tests, and optionally sync with the dev server. |
| 71 | |
| 72 | ## Package and Environment |
| 73 | |
| 74 | Install the latest v4 SDK: |
| 75 | |
| 76 | ```bash |
| 77 | npm install inngest@latest |
| 78 | # or pnpm add inngest@latest |
| 79 | # or yarn add inngest@latest |
| 80 | ``` |
| 81 | |
| 82 | If the repo uses v3 realtime, remove `@inngest/realtime`; v4 realtime lives in |
| 83 | the `inngest` package and subpaths such as `inngest/realtime`, `inngest/react`, |
| 84 | and native `step.realtime` / `inngest.realtime`. |
| 85 | |
| 86 | v4 defaults to Cloud mode. For local development, use an env var: |
| 87 | |
| 88 | ```bash |
| 89 | INNGEST_DEV=1 npm run dev |
| 90 | ``` |
| 91 | |
| 92 | Do not hardcode `isDev: true` in source unless the repo's existing environment |
| 93 | pattern clearly scopes it to local-only code. Production should use |
| 94 | `INNGEST_SIGNING_KEY`. |
| 95 | |
| 96 | ## Client and Serve Options |
| 97 | |
| 98 | In v4, options such as `signingKey`, `signingKeyFallback`, and `baseUrl` belong |
| 99 | on `new Inngest(...)`, not on `serve(...)`. |
| 100 | |
| 101 | ```typescript |
| 102 | // Old v3 |
| 103 | app.use( |
| 104 | "/api/inngest", |
| 105 | serve({ |
| 106 | client: inngest, |
| 107 | functions, |
| 108 | signingKey: process.env.INNGEST_SIGNING_KEY, |
| 109 | baseUrl: process.env.INNGEST_BASE_URL, |
| 110 | }) |
| 111 | ); |
| 112 | |
| 113 | // New v4 |
| 114 | export const inngest = new Inngest({ |
| 115 | id: "my-app", |
| 116 | signingKey: process.env.INNGEST_SIGNING_KEY, |
| 117 | baseUrl: process.env.INNGEST_BASE_URL, |
| 118 | }); |
| 119 | |
| 120 | app.use("/api/inngest", serve({ client: inngest, functions })); |
| 121 | ``` |
| 122 | |
| 123 | If the repo already relies on supported environment variables and does not pass |
| 124 | serve options explicitly, no code change may be required for those keys. |
| 125 | |
| 126 | Other renames: |
| 127 | |
| 128 | - `serveHost` -> `serveOrigin` |
| 129 | - `streaming: "force"` -> `streaming: true` |
| 130 | - `streaming: "allow"` -> `streaming: true` |
| 131 | - `streaming: false` stays `false` |
| 132 | - `logLevel` is removed; pass a `logger` such as `new ConsoleLogger({ level })` |
| 133 | |
| 134 | ## createFunction Triggers |
| 135 | |
| 136 | Triggers move into the first argument's options object. |
| 137 | |
| 138 | ```typescript |
| 139 | // Old v3 |
| 140 | inngest.createFunction( |
| 141 | { id: "send-welcome" }, |
| 142 | { event: "user/created" }, |
| 143 | async ({ event, step }) => {} |
| 144 | ); |
| 145 | |
| 146 | // New v4 |
| 147 | inngest.createFunction( |
| 148 | { id: "s |