Self-hosted Engine 3 rejects namespace provisioning payload with display_name (HTTP 422)

未关闭 适合新手
#305 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
88/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃

调研方向

阅读 packages/dynamic-apps/src/control-plane.ts 中的 provisionAppNamespace,并检查它构造的 self-hosted namespace 请求。验证该请求是否符合 issue 中描述的 Engine schema,然后确认在启用 namespace 创建的情况下部署成功。

由索引模型根据 Issue 内容生成。

描述

@rivet-dev/[email protected] cannot publish a plain Fetch-handler app against self-hosted Engine 3.0.0-preview.4 when it needs to create the per-app namespace. Its self-hosted namespace request includes display_name, which this Engine rejects as an unknown field.

Environment
Smallest HTTP reproduction

Against the disposable stack below (these are dummy credentials):

curl -i http://127.0.0.1:16420/namespaces \
  -H 'Authorization: Bearer repro-token' \
  -H 'Content-Type: application/json' \
  --data '{"name":"invalid-example","display_name":"Example"}'

Actual: HTTP 422:

Failed to deserialize the JSON body into the target type: display_name: unknown field `display_name`, expected `name` at line 1 column 40

The same endpoint with only the supported field succeeds with HTTP 200:

curl -i http://127.0.0.1:16420/namespaces \
  -H 'Authorization: Bearer repro-token' \
  -H 'Content-Type: application/json' \
  --data '{"name":"valid-example"}'
SDK behavior

A new app containing only a package.json and export default { fetch() { return new Response("hello"); } } builds successfully, but deployApp() rejects with:

code: dynamic_apps_namespace_create_failed
message: Rivet namespace creation failed with HTTP 422

Expected: namespace provisioning uses the Engine's supported request schema and the valid app deploys successfully.

The payload is constructed by provisionAppNamespace. Removing display_name from this self-hosted request was sufficient to let deployment proceed in a separate validation. The Docker reproduction below uses the unmodified published package and reproduces the failure.

Full SDK reproduction (disposable local stack)

All credentials below are deliberately invented and apply only to the disposable local stack. The Engine API is bound to loopback. The runner uses the Docker service hostname so RivetKit connects to the remote Engine rather than selecting its localhost/native development mode.

Files and commands

Save these files in an empty directory.

compose.yaml:

name: rivet-upstream-repro
services:
  seaweedfs:
    image: chrislusf/seaweedfs:4.51
    command: [mini, -dir=/data, -ip=seaweedfs, -ip.bind=0.0.0.0]
    environment:
      AWS_ACCESS_KEY_ID: repro-access
      AWS_SECRET_ACCESS_KEY: repro-secret
      S3_BUCKET: rivet
    volumes: [objects:/data]
    healthcheck:
      test: [CMD-SHELL, "curl -fsS http://localhost:9333/cluster/status >/dev/null"]
      interval: 2s
      timeout: 2s
      retries: 30
  engine:
    image: rivetdev/engine:3.0.0-preview.4
    depends_on:
      seaweedfs:
        condition: service_healthy
    environment:
      RIVET__AUTH__ADMIN_TOKEN: repro-token
      RIVET__OBJECT_STORAGE__PRIMARY__S3__ACCESS_KEY_ID: repro-access
      RIVET__OBJECT_STORAGE__PRIMARY__S3__SECRET_ACCESS_KEY: repro-secret
      AWS_ALLOW_HTTP: "true"
    ports: ["127.0.0.1:16420:6420"]
    volumes:
      - ./rivet.json:/etc/rivet/config.json:ro
      - log:/var/lib/rivet/log
    healthcheck:
      test: [CMD, curl, -fsS, http://localhost:6420/health]
      interval: 2s
      timeout: 2s
      retries: 30
  runner:
    profiles: [test]
    image: node:26.13.0-trixie-slim
    working_dir: /work
    volumes: [.:/work]
    environment:
      RIVET_ENDPOINT: http://repro:repro-token@engine:6420
      RIVET_POOL: default
      RIVET_ENVOY_VERSION: "1"
    entrypoint: [node, --import, tsx]
    command: [deploy.ts]
volumes:
  objects:
  log:

rivet.json:

{
  "storage": {
    "log_directory": "/var/lib/rivet/log",
    "auto_provision_partitions": 1,
    "balancing": {
      "enabled": false
    }
  },
  "object_storage": {
    "primary": {
      "s3": {
        "bucket": "rivet",
        "region": "us-east-1",
        "endpoint": "http://seaweedfs:8333",
        "prefix": "engine"
      }
    }
  }
}

setup.ts:

import { RivetClient } from "@rivetkit/engine-api-full";

const client = new RivetClient({
  environment: "http://127.0.0.1:16420",
  token: "repro-token", // Dummy credential for this disposable local stack.
});
await client.namespaces.create({ name: "repro" });
await client.pools.upsert("default", { namespace: "repro" });
console.log("Created the repro namespace and pool");

deploy.ts:

import { randomUUID } from "node:crypto";
import { deployApp } from "@rivet-dev/dynamic-apps";

const appId = `example-${randomUUID()}`;
const createNamespace = process.env.CREATE_NAMESPACE !== "false";
try {
  await deployApp({
    appId,
    createNamespace,
    files: {
      "package.json": JSON.stringify({ name: "example", private: true, type: "module", main: "index.js" }),
      "index.js": 'export default { fetch() { return new Response("hello"); } };',
    },
  });
  console.log("Deployment succeeded", { createNamespace });
  process.exit(0);
} catch (error) {
  console.error("Deployment failed", { createNamespace, message: error.message, code: error.code });
  process.exit(1);
}

Commands (Node.js 26.13.0 on the host):

docker compose up -d --wait
npm init -y
npm pkg set type=module
npm install --save-exact @rivet-dev/[email protected] @rivetkit/[email protected] [email protected]
npx tsx setup.ts
docker compose run --rm runner

The setup creates a fresh repro host namespace and default pool. On a just-started Engine, if setup reports depot/overloaded with routing_unavailable, wait for storage initialization and retry setup before running the reproduction.

Cleanup after testing, from this disposable directory only:

docker compose down --volumes
主要语言
TypeScript
星标
1k
派生
53
平均合并
2 小时 54 分钟
30 天内合并 PR
5

环境准备

  • 提供 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 没有贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

rivet-dev/dynamic-apps 的其他 Issue

查看 rivet-dev/dynamic-apps 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。