Skip to content

bug: Dashboard playground chat fails with CORS error: /in/append preflight returns 400 on api.trigger.dev (agent run never receives message) #4149

Description

@quintenb

Provide environment information

System:
OS: macOS 26.5.1
CPU: (12) arm64 Apple M2 Max
Memory: 293.34 MB / 32.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.17.1
Yarn: 1.22.19
npm: 10.9.2
pnpm: 10.26.2
bun: 1.3.14

Describe the bug

Testing a chat.agent() task via the Trigger.dev dashboard playground shows "Failed to fetch" in the UI. Browser DevTools shows the append request to api.trigger.dev fails with a CORS error, and the OPTIONS preflight returns 400.

The agent run starts successfully (preload → waiting for first message → suspended), but user messages never reach the worker (messages: [] in run payload).

SDK | @trigger.dev/sdk@4.5.0
CLI | bunx trigger.dev@latest dev → Trigger.dev 4.5.0

Image

To reproduce

I have this agent:

import { chat } from "@trigger.dev/sdk/ai";
import { streamText, stepCountIs } from "ai";
export const demoAgent = chat.agent({
  id: "demo-agent",
  run: async ({ messages, signal }) => {
    return streamText({
      ...chat.toStreamTextOptions(),
      model: /* OpenRouter gpt-4o-mini */,
      system: "You are a friendly demo assistant...",
      messages,
      abortSignal: signal,
      stopWhen: stepCountIs(15),
    });
  },
});

Steps to reproduce

  1. Run local dev worker:
  2. cd apps/trigger-test && bun run trigger:dev
  3. Confirm: Local worker ready on branch: default [node] -> 20260704.4
  4. Open Trigger.dev dashboard → dev environment.
  5. Open task demo-agent → use the chat/agent playground UI (not the regular JSON "Test" tab).
  6. Wait for preload (run starts, agent suspends at "waiting for first message").
  7. Type a message and send.
  8. UI shows "Failed to fetch".
Image

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions