connectOpenAi fails with `server_error code 42` on 0.4.2
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 45/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Tranquilla
- Stack tecnologico
- node.js, typescript
- Ambito
- api, audio-video-rtc, backend
Direzione di ricerca
Inizia dalla chiamata TypeScript connectOpenAi e segui la relativa richiesta fino all'endpoint /video/connect_agent di Stream utilizzando le versioni dell'SDK elencate. Riproduci il flusso webhook fornito e confronta l'errore code 42 propagato con una connessione diretta a OpenAI Realtime. Il lavoro è completato quando la stessa chiave valida può connettere un agent a una chiamata Stream Video senza l'errore opaco del server.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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: ''
}
}
- Lingua principale
- TypeScript
- Stelle
- 19
- Fork
- 3
- Merge medio
- 14h 5m
- PR unite (30g)
- 17
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di GetStream/stream-node
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
GetStream/stream-node#132 · 2 commenti ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
GetStream/stream-node#2 ·
Tutte le issue di GetStream/stream-node
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
safetrustcr/dApp-SafeTrust#426 ·
-
area:workflow bug ready-for-agent
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
fil-donadoni/tolaria#4409 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
Fission-AI/OpenSpec#1960 ·
-
Add dependabot Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
corsairdev/corsair#1764 ·