FullFact / health-misinfo-shared

Raphael health misinformation project, shared by Full Fact and Google
MIT License
0 stars 0 forks source link

CORS requests should succeed #34

Closed dcorney closed 3 months ago

dcorney commented 3 months ago

Describe the bug

When I type in a video ID and click "get claims" there's no response. The browser tools suggest a CORS error.

To Reproduce

Steps to reproduce the behaviour:

  1. Run the project locally using docker compose up -d
  2. Browse to http://127.0.0.1:4000/ and log in
  3. Enter a video id (e.g. 4WAFHXdTMbY)
  4. nothing happens
  5. open browser’s dev tools and observe error:
    Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://127.0.0.1:4000/api/transcripts/4WAFHXdTMbY. (Reason: CORS request did not succeed). Status code: (null).
    2
    Uncaught (in promise) TypeError: NetworkError when attempting to fetch resource. 

Expected behaviour

The video should be processed and the claims listed.

andylolz commented 3 months ago
[…] disallows reading the remote resource at https://127.0.0.1:4000/api/transcripts […]

^^ I think this might be the problem? This URL suggests there’s a problem in your configuration. baseUrl in App.js should be pointing at 'http://localhost:3000/api'.

FWIW, setting baseUrl to http://localhost:3000/api works for me without CORS errors.

andylolz commented 3 months ago

With recent changes this seems resolved now, but I’ll leave it with @dcorney to confirm and close.

andylolz commented 3 months ago

Closing this as resolved 🎉