Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Facing Error: Exceeded maxRedirects. Probably stuck in a redirect loop #20416 #21

Open
SriKKP opened this issue Mar 3, 2022 · 0 comments

Comments

@SriKKP
Copy link

SriKKP commented Mar 3, 2022

Hi,

I have cypress UI tests running successfully until few days ago when our authentication team has made a change that redirects the page twice, previously only once. This change has caused my tests to fail at cy.visit('/') with error

"We attempted to make an http request to this url but the request failed without a response
https://mybetawebsite/
We received this error at network level
Error: Exceeded maxRedirects. Probably stuck in a redirect loop https://mybetawebsite/redirect=signin&redirect=signin
at processRedirect (/private/var/folders/.........../Cypress.app/Contents/Resources/app/packages/server/node_modules/@cypress/request/lib/redirect.js:104:24..........."

When I asked them about this error, they told me to follow the redirect a second time.
"Just follow the same redirects a second time. You'll need to update your tests to follow the redirects a second time over."

I know cy.visit follows redirects (https://docs.cypress.io/api/commands/visit#Redirects) , but it does only once or multiple times?

Previously, when my tests were passing, I could see 302(redirection) at cy.visit (to different url for auth) and test used to continue and pass.

in my cypress.json, baseUrl: https://mybetawebsite/

How do I handle second redirect?

I have tried
1.increasing redirectionLimit in cypress.json (dinot work),
2. cy.intercept , but I cannot mention a url to redirect to because it is dynamic and comes from the another team
3. cypress retries ( i don't think this is the solution and it didnot work either)

the "if(self.redirectsFollowed >= self.maxRedirects)" in node_modules/@cypress/request/lib/redirect.js:104:24 is generating the issue. But how do I increase this maxRedirects

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant