connectOpenAi fails with `server_error code 42` on 0.4.2
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 45/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- node.js, typescript
- Lĩnh vực
- api, audio-video-rtc, backend
Hướng nghiên cứu
Bắt đầu từ lệnh gọi connectOpenAi trong TypeScript và theo dõi request của nó đến endpoint /video/connect_agent của Stream bằng các phiên bản SDK được liệt kê. Tái hiện bằng flow webhook được cung cấp và so sánh lỗi code 42 được truyền đi với một kết nối OpenAI Realtime trực tiếp. Hoàn tất khi cùng một key hợp lệ có thể kết nối một agent vào một cuộc gọi Stream Video mà không gặp lỗi server khó xác định.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
stream.video.connectOpenAi(...) consistently fails with server_error code 42 when connecting an OpenAI Realtime agent to a call. I have isolated the cause: the same OpenAI API key connects directly to OpenAI's GA Realtime API without error, so the key/account/access are fine. I guess the failure is still inside Stream's /video/connect_agent → OpenAI path.
Bumping to 0.4.2 (as advised on my previous, now-closed ticket) did not change the result.
What I'm trying to do
Connect an OpenAI Realtime (speech-to-speech) agent to a Stream Video call so it joins as a participant and talks. It's triggered server-side from the call.session_started webhook: look up the meeting/agent, then call connectOpenAi.
const call = stream.video.call("default", meetingId);
const client = await stream.video.connectOpenAi({
call,
openAiApiKey: process.env.OPENAI_API_KEY, // sk-proj-36XU_...
agentUserId: agent.id,
});
client.updateSession({ instructions });
No model is passed, so it defaults to gpt-realtime (GA).
Environment
- @stream-io/node-sdk: 0.7.62
- @stream-io/openai-realtime-api: 0.4.2
- @stream-io/video-react-sdk: 1.39.1 (client)
- Next.js: 16.2.10
What's failing
connectOpenAi rejects. The client only surfaces the opaque code 42:
Error: Stream connect_agent failed (code 42): Error: code
{
type: 'error',
error: { type: 'server_error', code: '42', message: 'Error: code ', param: null, event_id: '' }
}
The webhook itself is fine, signature verification passes (HTTP 200 via verifyAndParseWebhook on the raw gzipped body); the 500 comes solely from connectOpenAi.
Timeline
- On @stream-io/openai-realtime-api@0.4.0 → code 42.
- Support (previous ticket) said bump to 0.4.2; the ticket was closed.
- Bumped to 0.4.2 → still code 42, model set or unset.
Checks performed (ruling out my side)
- API key is loaded in the route: confirmed sk-proj-36XU_..., not undefined.
- Account: paid tier with credit.
- Model: default gpt-realtime (GA).
- Agent user: upserted via stream.upsertUsers([...]) at meeting creation, so the agentUserId exists as a Stream user on the call.
Decisive test: same key connects to OpenAI directly
I connected to OpenAI's GA Realtime API directly with the exact same OPENAI_API_KEY:
new WebSocket("wss://api.openai.com/v1/realtime?model=gpt-realtime", {
headers: { Authorization: `Bearer ${OPENAI_API_KEY}` }
});
Result: WebSocket opens cleanly, no error. So the key, its Realtime access, org verification, and tier are all confirmed working outside Stream.
Conclusion
This concluded that my OpenAI credentials/access were not the problem. Should probably be coming from Stream's connect_agent backend.
Error
⨯ Error: Stream connect_agent failed (code 42): Error: code
at ignore-listed frames {
type: 'error',
error: {
type: 'server_error',
code: '42',
message: 'Error: code ',
param: null,
event_id: ''
}
}
POST /api/webhook/stream 500 in 2.0s (next.js: 121ms, proxy.ts: 11ms, application-code: 1886ms)
POST /api/webhook/stream 200 in 514ms (next.js: 4ms, proxy.ts: 9ms, application-code: 501ms)
......
⨯ Error: Stream connect_agent failed (code 42): Error: code
at ignore-listed frames {
type: 'error',
error: {
type: 'server_error',
code: '42',
message: 'Error: code ',
param: null,
event_id: ''
}
}
- Ngôn ngữ chính
- TypeScript
- Star
- 19
- Fork
- 3
- Merge trung bình
- 14 giờ 5 phút
- Pull request đã merge (30 ngày)
- 17
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của GetStream/stream-node
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
GetStream/stream-node#132 · 2 bình luận ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
GetStream/stream-node#2 ·
Tất cả issue của GetStream/stream-node
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
safetrustcr/dApp-SafeTrust#426 ·
-
area:workflow bug ready-for-agent
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
fil-donadoni/tolaria#4409 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Fission-AI/OpenSpec#1960 ·
-
Add dependabot Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
corsairdev/corsair#1764 ·