inngest-cli
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseInngest CLI
Inngest CLI
Master the Inngest CLI for local development, testing, and self-hosted production. The CLI provides the Dev Server — a fully-featured, open-source local version of the Inngest Platform.
These skills are focused on TypeScript. For Python or Go, refer to the Inngest documentation for language-specific guidance. Core concepts apply across all languages.
Use this skill for CLI setup, Dev Server workflows, local testing, Docker, MCP, and self-hosted server operations. For run/trace inspection through , use when available.
inngest apiinngest-api-cli掌握用于本地开发、测试和自托管生产环境的Inngest CLI。CLI提供Dev Server——一个功能完备的开源本地版Inngest平台。
本技能聚焦于TypeScript。 若使用Python或Go,请参考Inngest文档获取语言特定指南。核心概念适用于所有语言。
本技能适用于CLI安装、Dev Server工作流、本地测试、Docker、MCP及自托管服务器操作。若需通过进行运行/追踪检查,请在可用时使用。
inngest apiinngest-api-cliInstallation
安装
bash
undefinedbash
undefinednpx (recommended — always latest)
npx(推荐——始终使用最新版本)
npx inngest-cli@latest dev
npx inngest-cli@latest dev
yarn
yarn
yarn dlx inngest-cli@latest dev
yarn dlx inngest-cli@latest dev
pnpm
pnpm
pnpm dlx inngest-cli@latest dev
pnpm dlx inngest-cli@latest dev
Global install
全局安装
npm install -g inngest-cli
npm install -g inngest-cli
Docker
Docker
docker pull inngest/inngest
If your npm configuration disables lifecycle scripts and the binary is missing, retry with `npx --ignore-scripts=false inngest-cli@latest dev`. Bun does not support lifecycle scripts by default, so prefer `npx` for the CLI even in Bun projects.docker pull inngest/inngest
若你的npm配置禁用了生命周期脚本导致二进制文件缺失,请重试:`npx --ignore-scripts=false inngest-cli@latest dev`。Bun默认不支持生命周期脚本,因此即使在Bun项目中也优先使用`npx`运行CLI。inngest dev
— Local Dev Server
inngest devinngest dev
—— 本地开发服务器
inngest devStarts an in-memory local version of Inngest with a browser UI at .
http://localhost:8288bash
undefined启动内存版本地Inngest服务,并在提供浏览器UI。
http://localhost:8288bash
undefinedAuto-discover apps on common ports/endpoints
自动发现常见端口/端点上的应用
npx inngest-cli@latest dev
npx inngest-cli@latest dev
Specify your app URL
指定应用URL
npx inngest-cli@latest dev -u http://localhost:3000/api/inngest
npx inngest-cli@latest dev -u http://localhost:3000/api/inngest
Custom port
自定义端口
npx inngest-cli@latest dev -p 9999
npx inngest-cli@latest dev -p 9999
Multiple apps
多个应用
npx inngest-cli@latest dev
-u http://localhost:3000/api/inngest
-u http://localhost:4000/api/inngest
-u http://localhost:3000/api/inngest
-u http://localhost:4000/api/inngest
npx inngest-cli@latest dev
-u http://localhost:3000/api/inngest
-u http://localhost:4000/api/inngest
-u http://localhost:3000/api/inngest
-u http://localhost:4000/api/inngest
Disable auto-discovery (use with -u)
禁用自动发现(需配合-u使用)
npx inngest-cli@latest dev --no-discovery -u http://localhost:3000/api/inngest
undefinednpx inngest-cli@latest dev --no-discovery -u http://localhost:3000/api/inngest
undefinedCLI Flags
CLI标志
| Flag | Short | Default | Description |
|---|---|---|---|
| | | App serve endpoint URL(s) |
| | | Dev Server port |
| Dev Server host | ||
| | Disable auto-discovery of apps | |
| | Disable polling apps for changes | |
| Path to configuration file | ||
| | Connect gateway endpoint port | |
| | Persist data between restarts | |
| | Seconds between app polling checks | |
| | Number of executor workers | |
| | Linear retry interval in seconds | |
| | Executor queue polling interval in milliseconds |
| 标志 | 缩写 | 默认值 | 描述 |
|---|---|---|---|
| | | 应用服务端点URL(可多个) |
| | | Dev Server端口 |
| Dev Server主机地址 | ||
| | 禁用应用自动发现 | |
| | 禁用应用变更轮询 | |
| 配置文件路径 | ||
| | Connect网关端点端口 | |
| | 重启后保留数据 | |
| | 应用轮询检查间隔(秒) | |
| | 执行器工作线程数量 | |
| | 线性重试间隔(秒) | |
| | 执行器队列轮询间隔(毫秒) |
Auto-Discovery
自动发现
Without , the Dev Server scans common ports and endpoints automatically:
--no-discoveryPorts scanned: Common development ports including 3000, 3030, and others
Endpoints scanned:
/api/inngest/x/inngest/.netlify/functions/inngest/.redwood/functions/inngest
未设置时,Dev Server会自动扫描常见端口和端点:
--no-discovery扫描的端口: 包括3000、3030等常见开发端口
扫描的端点:
/api/inngest/x/inngest/.netlify/functions/inngest/.redwood/functions/inngest
Configuration File
配置文件
Create an (or , ) in your project root. The CLI walks up directories to find it.
inngest.json.yaml.tomljson
{
"sdk-url": [
"http://localhost:3000/api/inngest",
"http://localhost:3030/api/inngest"
],
"no-discovery": true
}yaml
undefined在项目根目录创建(或、)文件。CLI会向上遍历目录查找该文件。
inngest.json.yaml.tomljson
{
"sdk-url": [
"http://localhost:3000/api/inngest",
"http://localhost:3030/api/inngest"
],
"no-discovery": true
}yaml
undefinedinngest.yaml
inngest.yaml
sdk-url:
- "http://localhost:3000/api/inngest"
- "http://localhost:3030/api/inngest" no-discovery: true
undefinedsdk-url:
- "http://localhost:3000/api/inngest"
- "http://localhost:3030/api/inngest" no-discovery: true
undefinedEnvironment Variables
环境变量
| Variable | Description |
|---|---|
| |
| Host for SDK-to-Inngest communication (e.g., |
| Authentication key for sending events. Use any dummy value locally — Dev Server does not validate. |
| Secures requests between Inngest and your app. Required in production. Determines which Inngest environment receives syncs. |
| Fallback key for signing key rotation (v3.18.0+). |
| Full origin URL for Inngest to reach your app (e.g., |
| URL path to your serve endpoint (e.g., |
| Enable response streaming ( |
| Target Inngest Environment. Auto-detected on some platforms. |
| 变量 | 描述 |
|---|---|
| |
| SDK与Inngest通信的主机地址(如 |
| 发送事件的认证密钥。本地可使用任意虚拟值——Dev Server不做验证。 |
| 保障Inngest与应用间请求的安全性。生产环境必填。 决定同步数据发送至哪个Inngest环境。 |
| 签名密钥轮换的备用密钥(v3.18.0+)。 |
| Inngest访问你的应用的完整源URL(如 |
| 应用服务端点的URL路径(如 |
| 启用响应流( |
| 目标Inngest环境。部分平台可自动检测。 |
Debugging Your Serve Endpoint
调试服务端点
Verify your endpoint is configured correctly:
serve()bash
curl -s http://localhost:3000/api/inngest | jqjson
{
"message": "Inngest endpoint configured correctly.",
"hasEventKey": false,
"hasSigningKey": false,
"functionsFound": 3
}If is , check that your functions are passed to the call.
functionsFound0serve()验证你的端点配置是否正确:
serve()bash
curl -s http://localhost:3000/api/inngest | jqjson
{
"message": "Inngest endpoint configured correctly.",
"hasEventKey": false,
"hasSigningKey": false,
"functionsFound": 3
}若为,请检查是否将函数传入了调用。
functionsFound0serve()Testing Functions Locally
本地测试函数
Send Events via SDK
通过SDK发送事件
typescript
import { Inngest } from "inngest";
const inngest = new Inngest({ id: "my-app" });
await inngest.send({
name: "user/signup.completed",
data: {
userId: "user_123",
email: "user@example.com",
},
});typescript
import { Inngest } from "inngest";
const inngest = new Inngest({ id: "my-app" });
await inngest.send({
name: "user/signup.completed",
data: {
userId: "user_123",
email: "user@example.com",
},
});Send Events via curl
通过curl发送事件
bash
curl -X POST "http://localhost:8288/e/test" \
-H "Content-Type: application/json" \
-d '{
"name": "user/signup.completed",
"data": {
"userId": "user_123",
"email": "user@example.com"
}
}'The event key in the URL path ( above) can be any value locally.
testbash
curl -X POST "http://localhost:8288/e/test" \
-H "Content-Type: application/json" \
-d '{
"name": "user/signup.completed",
"data": {
"userId": "user_123",
"email": "user@example.com"
}
}'URL路径中的事件密钥(如上例中的)在本地可设为任意值。
testUnit Testing with @inngest/test
@inngest/test使用@inngest/test
进行单元测试
@inngest/testRequires .
inngest@>=4.0.0bash
npm install -D @inngest/testtypescript
import { InngestTestEngine } from "@inngest/test";
import { helloWorld } from "./functions";
// Execute full function
const t = new InngestTestEngine({ function: helloWorld });
const { result } = await t.execute();
expect(result).toEqual("Hello World!");
// Test a single step
const { result: stepResult } = await t.executeStep("calculate-price");
expect(stepResult).toEqual(123);
// Assert step state
const { state } = await t.execute();
await expect(state["my-step"]).resolves.toEqual("output");
await expect(state["risky-step"]).rejects.toThrowError("failed");
// Mock events
const { result: eventResult } = await t.execute({
events: [{ name: "demo/event.sent", data: { message: "Hi!" } }],
});
// Mock step responses
const { result: mockResult } = await t.execute({
steps: [{ id: "external-api-call", handler() { return { status: "ok" }; } }],
});
// Mock sleep/waitForEvent (pause-inducing steps require mocking)
await t.execute({
steps: [{ id: "wait-one-day", handler() {} }],
});Mock external dependencies with your test framework's standard mocking (, , etc.) — handles only Inngest-specific mocking.
jest.mockvi.mock@inngest/test需版本。
inngest@>=4.0.0bash
npm install -D @inngest/testtypescript
import { InngestTestEngine } from "@inngest/test";
import { helloWorld } from "./functions";
// 执行完整函数
const t = new InngestTestEngine({ function: helloWorld });
const { result } = await t.execute();
expect(result).toEqual("Hello World!");
// 测试单个步骤
const { result: stepResult } = await t.executeStep("calculate-price");
expect(stepResult).toEqual(123);
// 断言步骤状态
const { state } = await t.execute();
await expect(state["my-step"]).resolves.toEqual("output");
await expect(state["risky-step"]).rejects.toThrowError("failed");
// 模拟事件
const { result: eventResult } = await t.execute({
events: [{ name: "demo/event.sent", data: { message: "Hi!" } }],
});
// 模拟步骤响应
const { result: mockResult } = await t.execute({
steps: [{ id: "external-api-call", handler() { return { status: "ok" }; } }],
});
// 模拟睡眠/等待事件(暂停类步骤需模拟)
await t.execute({
steps: [{ id: "wait-one-day", handler() {} }],
});模拟外部依赖请使用测试框架的标准模拟方法(、等)——仅处理Inngest特定的模拟。
jest.mockvi.mock@inngest/testDocker Setup
Docker配置
Standalone
独立运行
bash
docker run -p 8288:8288 -p 8289:8289 \
inngest/inngest \
inngest dev -u http://host.docker.internal:3000/api/inngestUse to reach your app running on the host machine (works out of the box on Docker Desktop). On Linux, add or use an equivalent host-access method.
host.docker.internal--add-host=host.docker.internal:host-gatewaybash
docker run -p 8288:8288 -p 8289:8289 \
inngest/inngest \
inngest dev -u http://host.docker.internal:3000/api/inngest使用访问运行在宿主机上的应用(Docker Desktop默认支持)。在Linux系统中,需添加或使用等效的主机访问方式。
host.docker.internal--add-host=host.docker.internal:host-gatewayDocker Compose
Docker Compose
yaml
services:
app:
build: ./app
environment:
- INNGEST_DEV=1
- INNGEST_BASE_URL=http://inngest:8288
ports:
- "3000:3000"
inngest:
image: inngest/inngest
command: "inngest dev -u http://app:3000/api/inngest"
ports:
- "8288:8288"
- "8289:8289"Port 8288 is the main server and UI. Port 8289 is the WebSocket gateway.
connect()Critical: Set on your app — the TypeScript SDK defaults to Cloud mode, which will skip the Dev Server.
INNGEST_DEV=1yaml
services:
app:
build: ./app
environment:
- INNGEST_DEV=1
- INNGEST_BASE_URL=http://inngest:8288
ports:
- "3000:3000"
inngest:
image: inngest/inngest
command: "inngest dev -u http://app:3000/api/inngest"
ports:
- "8288:8288"
- "8289:8289"端口8288是主服务器和UI端口。端口8289是 WebSocket网关端口。
connect()关键提示: 在你的应用中设置——TypeScript SDK默认使用云模式,会跳过Dev Server。
INNGEST_DEV=1MCP Server (AI Dev Tools)
MCP服务器(AI开发工具)
The Dev Server exposes an MCP server at (HTTP transport).
http://127.0.0.1:8288/mcpbash
undefinedDev Server在暴露MCP服务器(HTTP传输)。
http://127.0.0.1:8288/mcpbash
undefinedClaude Code
Claude Code
claude mcp add --transport http inngest-dev http://127.0.0.1:8288/mcp
```json
// .cursor/mcp.json or another MCP-capable client config
{
"mcpServers": {
"inngest-dev": {
"url": "http://127.0.0.1:8288/mcp"
}
}
}claude mcp add --transport http inngest-dev http://127.0.0.1:8288/mcp
```json
// .cursor/mcp.json 或其他支持MCP的客户端配置
{
"mcpServers": {
"inngest-dev": {
"url": "http://127.0.0.1:8288/mcp"
}
}
}Available MCP Tools
可用MCP工具
| Tool | Description |
|---|---|
| Send events to trigger functions |
| List all registered functions and triggers |
| Execute a function synchronously (default 30s timeout) |
| Get detailed status of a function run |
| Poll multiple runs until completion |
| Search Inngest documentation by regex pattern |
| Read a specific documentation page |
| List available documentation structure |
| 工具 | 描述 |
|---|---|
| 发送事件以触发函数 |
| 列出所有已注册的函数和触发器 |
| 同步执行函数(默认超时30秒) |
| 获取函数运行的详细状态 |
| 轮询多个运行任务直至完成 |
| 通过正则表达式搜索Inngest文档 |
| 读取特定文档页面 |
| 列出可用的文档结构 |
inngest start
— Self-Hosted Production
inngest startinngest start
—— 自托管生产环境
inngest startRuns Inngest as a self-hosted production server. Not the same as — this is for production workloads.
inngest devbash
inngest start --event-key <key> --signing-key <key>| Flag | Short | Default | Description |
|---|---|---|---|
| | | Server port |
| Hex key for request signing (even character count) | ||
| Authentication key for apps (repeatable) | ||
| | App serve URLs (repeatable) | |
| External Redis connection | ||
| External PostgreSQL connection | ||
| SQLite database directory | ||
| | App sync polling interval (seconds) | |
| | Number of executor workers | |
| | Connect gateway port | |
| | Linear retry interval in seconds | |
| | Executor queue polling interval in milliseconds | |
| Disable web UI and GraphQL API | ||
| | PostgreSQL idle connection lifetime in minutes | |
| | PostgreSQL maximum connection reuse time in minutes | |
| | PostgreSQL max idle connections | |
| | PostgreSQL max open connections |
Global flags such as , , and are also available. For environment variables, follow the current CLI and deployment docs; do not assume every flag has an environment variable equivalent.
--log-level--verbose--jsonINNGEST_Default persistence: in-memory Redis + SQLite at . For production, use external Redis and PostgreSQL.
./.inngest/main.db将Inngest作为自托管生产服务器运行。与不同——此命令用于生产工作负载。
inngest devbash
inngest start --event-key <key> --signing-key <key>| 标志 | 缩写 | 默认值 | 描述 |
|---|---|---|---|
| | | 服务器端口 |
| 请求签名用的十六进制密钥(长度为偶数) | ||
| 应用认证密钥(可重复设置) | ||
| | 应用服务URL(可重复设置) | |
| 外部Redis连接地址 | ||
| 外部PostgreSQL连接地址 | ||
| SQLite数据库目录 | ||
| | 应用同步轮询间隔(秒) | |
| | 执行器工作线程数量 | |
| | Connect网关端口 | |
| | 线性重试间隔(秒) | |
| | 执行器队列轮询间隔(毫秒) | |
| 禁用Web UI和GraphQL API | ||
| | PostgreSQL空闲连接生命周期(分钟) | |
| | PostgreSQL连接最大复用时间(分钟) | |
| | PostgreSQL最大空闲连接数 | |
| | PostgreSQL最大开放连接数 |
全局标志如、和也可用。关于环境变量,请参考当前CLI和部署文档;不要假设每个标志都有对应的环境变量。
--log-level--verbose--jsonINNGEST_默认持久化方式:内存Redis + 位于的SQLite。生产环境建议使用外部Redis和PostgreSQL。
./.inngest/main.dbDeployment Workflow
部署工作流
Local Development → Production
本地开发 → 生产环境
- Develop locally with — no keys needed, no code changes for production
inngest dev - Deploy your app to your hosting platform
- Sync with Inngest using one of three methods:
bash
undefined- 本地开发使用——无需密钥,切换到生产环境无需修改代码
inngest dev - 部署应用到你的托管平台
- 与Inngest同步可使用以下三种方法之一:
bash
undefinedOption 1: Curl from CI/CD
选项1:通过CI/CD执行curl
curl -X PUT https://your-app.com/api/inngest --fail-with-body
curl -X PUT https://your-app.com/api/inngest --fail-with-body
Option 2: Vercel/Netlify integrations (automatic on deploy)
选项2:Vercel/Netlify集成(部署时自动同步)
Option 3: Manual sync via Inngest Cloud dashboard
选项3:通过Inngest Cloud控制台手动同步
4. **Set environment variables** in production:
```bash
INNGEST_EVENT_KEY=<your-event-key>
INNGEST_SIGNING_KEY=<your-signing-key>No code changes are needed when moving from local dev to production. The SDK automatically detects the environment.
4. **在生产环境设置环境变量**:
```bash
INNGEST_EVENT_KEY=<你的事件密钥>
INNGEST_SIGNING_KEY=<你的签名密钥>无需修改代码即可从本地开发切换到生产环境。SDK会自动检测环境。
Platform-Specific Gotchas
平台特定注意事项
| Platform | Gotcha |
|---|---|
| Express | Requires |
| AWS Lambda | Set |
| Firebase Cloud Functions | Must set |
| DigitalOcean Functions | Both |
Cloudflare Workers (Wrangler | Requires tunnel (ngrok/localtunnel) for Dev Server connection |
| Supabase Edge Functions | |
| Google Cloud Run (1st gen) | Not officially supported; may cause signature verification errors |
| Docker | Must set |
| External webhooks (Stripe, Clerk) | Require tunnel solution (ngrok, localtunnel) for local testing |
| 平台 | 注意事项 |
|---|---|
| Express | 需要 |
| AWS Lambda | 需显式设置 |
| Firebase Cloud Functions | 必须设置 |
| DigitalOcean Functions | 在 |
Cloudflare Workers(Wrangler | 需要隧道(ngrok/localtunnel)才能连接Dev Server |
| Supabase Edge Functions | |
| Google Cloud Run(第一代) | 未官方支持;可能导致签名验证错误 |
| Docker | 必须设置 |
| 外部Webhook(Stripe、Clerk) | 本地测试需要隧道解决方案(ngrok、localtunnel) |
Quick Reference
快速参考
bash
undefinedbash
undefinedStart dev server with auto-discovery
启动带自动发现的开发服务器
npx inngest-cli@latest dev
npx inngest-cli@latest dev
Start with explicit app URL
使用指定应用URL启动
npx inngest-cli@latest dev -u http://localhost:3000/api/inngest
npx inngest-cli@latest dev -u http://localhost:3000/api/inngest
Check serve endpoint health
检查服务端点健康状态
curl -s http://localhost:3000/api/inngest | jq
curl -s http://localhost:3000/api/inngest | jq
Send test event via curl
通过curl发送测试事件
curl -X POST http://localhost:8288/e/test -d '{"name": "test/event", "data": {}}'
curl -X POST http://localhost:8288/e/test -d '{"name": "test/event", "data": {}}'
Sync after deploy (CI/CD)
部署后同步(CI/CD)
curl -X PUT https://your-app.com/api/inngest --fail-with-body
curl -X PUT https://your-app.com/api/inngest --fail-with-body
Self-hosted production
自托管生产环境启动
inngest start --event-key <key> --signing-key <key>
undefinedinngest start --event-key <key> --signing-key <key>
undefinedTroubleshooting
故障排除
| Issue | Cause | Solution |
|---|---|---|
| Dev Server doesn't find functions | App not running or wrong port | Start your app first; use |
| Functions not passed to | Verify all functions are in the array passed to |
| SDK connects to Cloud instead of Dev Server | | Set |
| Functions sync to wrong Inngest environment | Wrong signing key | Check |
| Duplicate app in Inngest dashboard | App | Keep the |
| Webhook events not reaching Dev Server | No tunnel configured | Use ngrok or localtunnel for external webhook sources |
| "Unattached sync" in dashboard | Auto-sync failed silently | Check integration logs; resync manually |
See inngest-setup for SDK installation and inngest-durable-functions for function configuration.
| 问题 | 原因 | 解决方案 |
|---|---|---|
| Dev Server找不到函数 | 应用未运行或端口错误 | 先启动应用;使用 |
调试输出中 | 函数未传入 | 验证所有函数都已传入 |
| SDK连接到Cloud而非Dev Server | 未设置 | 在环境中设置 |
| 函数同步到错误的Inngest环境 | 签名密钥错误 | 检查 |
| Inngest控制台中出现重复应用 | 应用 | 在 |
| Webhook事件无法到达Dev Server | 未配置隧道 | 使用ngrok或localtunnel处理外部Webhook源 |
| 控制台中出现"未关联的同步" | 自动同步静默失败 | 检查集成日志;手动重新同步 |
SDK安装请参考inngest-setup,函数配置请参考inngest-durable-functions。