#Unable to send web requests using fetch inside of a worker
1 messages · Page 1 of 1 (latest)
That isn't the correct way to use fetch - https://developer.mozilla.org/en-US/docs/Web/API/fetch
const response = await fetch("https://api.github.com/repos/Betrayed-hub/peter-hub/contents/allgames.json", options);
hm, that is what I had before and I was getting a different error called TypeError: terminated and a 403 even though the same request done in postman works
403 would indicate GitHub blocked the request
that is how you set headers in fetch, that is the only reason they would block it.
You'll need to set a User Agent in your headers for GitHub
https://docs.github.com/en/rest/overview/resources-in-the-rest-api?apiVersion=2022-11-28#user-agent-required
- fixed it, turns out I was not setting a user-agent and just figured fetch was doing it by default