Closed lecegues closed 5 months ago
These are some domains for which I have debugged to try and find the source of the bug
axios.defaults.adapter = 'http'
to use the "http" adapter instead of the default XMLHTTPREQUEST adapter.localhost:3000
was not accessible 127.0.0.1
(localhost) address127.0.0.1
(IPV4)localhost:3000
addresses to 127.0.0.1
addresses to forcefully connect using IPV4; at this point, I believe that localhost
is being resolved to IPV6.127.0.01
.localhost
to IPV4 addresses in the frontendAdded a commit to create a global axios configuration file (http.js) with an IPV4 baseURL: "http://127.0.0.1:3000"
to keep a constant address in all environments.
This lets the test pass. Problem solved upon branch merge
import http from "../http";
and use this instead of axios (including test files).localhost
, just put the API address: e.g. http.post('/users')
Login feature was not working due to the different addresses; localhost
resolves as 127.0.0.1
however it is not the same value (e.g. localhost != 127.0.0.1), so CORS is handled differently.
The encountered bug: Does not assign the signed token as a cookie to the browser upon login.
Problem: localhost
!= 127.0.0.1
but it resolves to it; this means that technically requests made are cross-site requests (not the same site)
Fix: when assigning cookies, must use secure: true, sameSite: "None"
to allow cross-site requests
Problem
Some frontend integration tests that explicitly reference
localhost:3000
to [GET, POST] are giving ECONNREFUSED errors inside the CI Pipeline, causing tests to failExample Pipeline Failure: https://github.com/UniversityOfSaskatchewanCMPT371/term-project-2024-team-4/actions/runs/8405274261/job/23017788982