-
Hey guys, I have integrated next-auth using the credentials provider and this seems to be working well throughout the app with my apollo client, however I am having a hard time getting my Cypress tests to pass Currently via Cypress I run true e2e tests, meaning I have a local backend server setup in a docker container and run my tests against this with either seeded data on the backend, or via various cypress commands or methods created to help create some data for my tests. These are mainly around users data required to perform the various actions required. Before next-auth we would get an jwt accessToken after login for a user from our backend and just store this in a cookie which would be reused via our apollo client which would retrieve this cookie. With next-auth this changed slightly but we essentially just get this from the When trying to setup Cypress + NextAuth I basically replaced the below line
with
This would essentially get the accessToken from the direct api call to our backend logged in user, and then take this token and set the required signed My issue is when I run various tests where user is pre-authenticated on my first
So I have VPN on and assumed it must be related so I turned it off, reran same issue. Then I decided to just turn off my wifi, eureka it works. But why? Whenever I have my wifi on I consistently get this issue on any and all tests, and with my wifi off it works fine. I'm wondering when going to the I also notice the following error in my console logs
Prior to the next-auth integration this was working all fine, so I suspect it's definitely related to next-auth and possible to the Providing a reproducible repo will be difficult but I will see if I can manage somehow. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
This suggests that you are calling a client-side-only API (maybe the See which functions are supposed to work where: https://next-auth.js.org/getting-started/client |
Beta Was this translation helpful? Give feedback.
-
[Update] I was able to resolve my issue locally by setting a no_proxy=localhost , more info here: https://docs.cypress.io/guides/references/proxy-configuration#Set-a-proxy-on-Linux-or-macOS Seems still in my Gitlab CI, even though I export the NO_PROXY, I am still getting the issue. It does seem that this issue is not next-auth related but more so related to Cypress and how it proxies requests to the browser. |
Beta Was this translation helpful? Give feedback.
[Update]
I was able to resolve my issue locally by setting a no_proxy=localhost , more info here: https://docs.cypress.io/guides/references/proxy-configuration#Set-a-proxy-on-Linux-or-macOS
Seems still in my Gitlab CI, even though I export the NO_PROXY, I am still getting the issue. It does seem that this issue is not next-auth related but more so related to Cypress and how it proxies requests to the browser.