Rob--W / cors-anywhere

CORS Anywhere is a NodeJS reverse proxy which adds CORS headers to the proxied request.
MIT License
8.5k stars 5.92k forks source link

getting an Uncaught (in promise) SyntaxError #470

Closed LOGODERKING closed 9 months ago

LOGODERKING commented 9 months ago

If I try to connect my website with my cors-anywhere server i get the following error: Uncaught (in promise) SyntaxError: Unexpected token 'T', "This API e"... is not valid JSON how can i fix that?

Rob--W commented 9 months ago

That response is not emitted by CORS Anywhere itself and is probably an issue with your use of the destination API you are trying to reach through the proxy. Consider using the browser's developer tools to inspect the actual response body (or log the response body before using JSON.parse) to see the actual error message.

If this is an API that adapts its response type based on the request headers, include the Accept: application/json request header to signal interest in a JSON response.