WaspW
Wasp9mo ago
10 replies
yalcinos

CORS issue on content-type: text/event-stream OpenAI

I am using event stream to create an endpoint to stream open ai responses as chunks.

I created a POST endpoint (
/explainer
) to consume it but i am getting cors error when i try to hit from other localhost port. Does anyone know why?

FYI: I had another POST endpoint that content-type is json doesn't have CORS issue though only this endpoint has cors issue. Does anyone know why?

I am thinking something is wrong with
res.setHeader("Content-Type", "text/event-stream");
Screenshot_2025-05-12_at_11.11.04_PM.png
Was this page helpful?