Problem
An edge function which should return a streaming JSON response responses like:
0:"{\n"
0:" "
0:" \""
0:"direct"
0:"_response"
0:"\":"
0:" \""
0:"I"
0:" am"
0:" a"
0:" powerful"
0:" agent"
0:" who"
0:" can"
0:" use"
0:" tools"
0:" to"
0:" help"
0:" you"
0:" with"
0:" your"
0:" queries"
0:"."
0:" Feel"
0:" free"
0:" to"
0:" ask"
0:" me"
0:" anything"
0:"!\"\n"
0:"}"
But it should returns:
{
"direct_response": "I am a powerful agent who can use tools to help you with your queries."
}
The content-type
in headers is application/json
but the response is strangely malformed. I never write code like this: 0: ...
So I think this is a bug in one of Netlify’s gateway layers. Previously I didn’t encountered this strange problem but I found this this week.
I’ve emailed the Netlify Support and they kindly asked me to share it here. So, thank everyone who can help this!
Reproduction
Ask who are you
int the textbox on reasonify.netlify.app
and see the devtool.
If you wonder the right response, I created a build on Vercel which seems to run correctly.
Information
- netlify site name:
reasonify
- x-nf-request-id:
01HWKKK30ESHHH425XTQSCNJQS