threads-api icon indicating copy to clipboard operation
threads-api copied to clipboard

Axios - Network Error

Open kevinfosse opened this issue 2 years ago • 4 comments

Hello @junhoyeo, now that the 'fs' module work, i'm coming with a new problem..

Maybe it's my i'm bad but i got this error: image

Then, i put my console.log here :

An attempt to set a forbidden header was blocked: origin page.js line 359 > eval:2351:16 An attempt to set a forbidden header was blocked: Sec-Fetch-Site page.js line 359 > eval:2351:16 An attempt to set a forbidden header was blocked: referer page.js line 359 > eval:2351:16 An attempt to set a forbidden header was blocked: sec-fetch-dest page.js line 359 > eval:2351:16 An attempt to set a forbidden header was blocked: sec-fetch-mode page.js line 359 > eval:2351:16 An attempt to set a forbidden header was blocked: sec-fetch-user page.js line 359 > eval:2351:16 Cross-Origin Request Blocked: The "Same Origin" policy does not allow accessing the remote resource located at https://www.threads.net/@unyxes. Reason: The CORS header "Access-Control-Allow-Origin" is missing. Status code: 200.

Cross-Origin Request Blocked: The "Same Origin" policy does not allow accessing the remote resource located at https://www.threads.net/@unyxes. Reason: CORS request failed. Status code: (null).

kevinfosse avatar Jul 13 '23 13:07 kevinfosse

It looks like you're trying to access the API from the client side, which is not supported yet.

Since you're using Next you could try to put the API calls in the server side.

yssf-io avatar Jul 13 '23 14:07 yssf-io

Hmm I see you're using next.js app router. Strange, we're also using it inside page.tsx in web-ui: https://github.com/junhoyeo/threads-api/blob/main/threads-web-ui/app/%5Busername%5D/page.tsx#L14

junhoyeo avatar Jul 14 '23 03:07 junhoyeo

@kevinfosse Can you make/share a repro repo?

junhoyeo avatar Jul 14 '23 03:07 junhoyeo

@yssf-io @junhoyeo

Hi, you can close this issue, I switched to Express on the backend to use threads-api and React on the frontend, it seems to work better, no 'fs' or axios problems.

Thank you all for your help lately, take care

kevinfosse avatar Jul 14 '23 08:07 kevinfosse