Skip to content

Commit aef68ae

Browse files
demo: fix useChat demo regression from id → chatId rename
Commit 6ef8a77 renamed `SendMessagesRequestContext.id` to `chatId` and updated the SDK source, tests, and internal docs, but missed the useChat demo's server route, which still reads `id` from the POST body. That left `ably.channels.get(undefined)` on the server, so publishes targeted a fallback channel name that did not match the `ai` namespace rule — manifesting as error 93002 ("Can only update/delete/append messages on channels with mutableMessages enabled") once the transport attempted any UPDATE/DELETE action. Update the server route to read `chatId` from the body so it attaches to the channel name the client intended. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent f3112f7 commit aef68ae

File tree

1 file changed

+3
-3
lines changed
  • demo/vercel/react/use-chat/src/app/api/chat

1 file changed

+3
-3
lines changed

demo/vercel/react/use-chat/src/app/api/chat/route.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ interface ChatRequestBody {
2121
clientId: string;
2222
messages: MessageNode<UIMessage>[];
2323
history?: MessageNode<UIMessage>[];
24-
id: string;
24+
chatId: string;
2525
forkOf?: string;
2626
parent?: string;
2727
}
@@ -30,8 +30,8 @@ interface ChatRequestBody {
3030
const ably = new Ably.Realtime({ key: process.env.ABLY_API_KEY! });
3131

3232
export async function POST(req: Request) {
33-
const { messages, history, id, turnId, clientId, forkOf, parent } = (await req.json()) as ChatRequestBody;
34-
const channel = ably.channels.get(id);
33+
const { messages, history, chatId, turnId, clientId, forkOf, parent } = (await req.json()) as ChatRequestBody;
34+
const channel = ably.channels.get(chatId);
3535

3636
const transport = createServerTransport({ channel });
3737
const turn = transport.newTurn({ turnId, clientId, parent, forkOf, signal: req.signal });

0 commit comments

Comments
 (0)