Certain get request not working in workers. but works in browser
hi, anyone know why i cant do fetch on this endpoint? keep getting 400 bad request. it works fine in browser.
const streamIngestUrlRes = await fetch('https://ingest.twitch.tv/ingests')
4 Replies
It’s possible they’re blocking requests from workers, or without a user agent, or ones that don’t look like real browsers.
You could try adding headers to make it look like a real browser first.
curl -XGET
returns the json data and it sends these request headers: i get this error when i do
await streamIngestUrlRes.json()
as a work-around, im just making the call in the frontend and sending the data to the backend.Well, at some point the request might return a TLS error, even from the browser (try hard-refreshing multiple times). So maybe it's not your problem. You can put a retry on fetch in case of such error.