Masked API 400 error reason when streaming responses #346
Labels
priority: p2
Moderately-important priority. Fix may not be included in next release.
type: bug
Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Environment details
Steps to reproduce
Overview
When handling the error, there's a check for
application/json
inthrowErrorIfNotOK
js-genai/src/_api_client.ts
Line 622 in f2df6d7
This check fails since the content type is
text/event-stream
when streaming, and the error body is not handled at all:js-genai/src/_api_client.ts
Lines 624 to 632 in f2df6d7
This masks the true error from being seen by the developer.
After applying the following patch, I could see what I was doing wrong:
The text was updated successfully, but these errors were encountered: