cypress-io / cypress

Fast, easy and reliable testing for anything that runs in a browser.
https://cypress.io
MIT License
46.67k stars 3.16k forks source link

getting random http response code 500 #2218

Open ainglese opened 6 years ago

ainglese commented 6 years ago

Current behavior & Steps to reproduce:

This works as expected:

cy.visit('http://localhost:8080/ui/st.bquadro/agent');
cy.get('.login-content input[type=text]')
    .type('admin')
    .should('have.value', 'admin');

cy.get('.login-content input[type=password]')
    .type('xxxx')
    .should('have.value', 'xxxx');

cy.get('.login-content .submit input[name=commit]').click();

cy.visit('http://localhost:8080/ui/st.bquadro/agent#dashboard', {
    auth: { username: 'admin', password: 'xxxx' }
});

but this gives some network errors (status code 500):

cy.visit('http://localhost:8080/ui/st.bquadro/agent#dashboard', {
    auth: { username: 'admin', password: 'xxxx' }
});

i've run our application with a debugger, and i'm almost sure our web server is not returning an error but a 200 OK.

the requests that fails are not always the same: image but one of four files, just one of them succeeds. i've run cypress in debug mode and

Desired behavior:

test should not throw random 500.

Versions

windows 10 pro + chrome + cypress 3.0.2

ainglese commented 6 years ago

addendum, please note that:

please note also that i'm almost new to cypress, so there could be something obvious going on here, but i've tryed asking the community on the gitter channel without success.

Francis-Moreau-adsk commented 5 years ago

We get the same type of behavior with the app we are trying to auto-test. For us, the error 500 is more consistent but still doesn't make sens. Login in and out twice in the same _specs.js will throw some error 500 on the second attempt to log in.

mabedan commented 5 years ago

Same issue here. We know for a fact that the requests are not hitting our server, and we've not been able to find any pattern to it. it's really random...

jennifer-shehane commented 5 years ago

We'll need a reproducible example in order to begin looking into this issue. Can anyone provide a way to reproduce this?

ADavisDon commented 5 years ago

I've encountered this error every time with our own website project. It'll occurs shortly after finishing a test. However, the longer that I use Cypress, the shorter the time length before hitting the 500 code, due to building lag in the Cypress browser. If I close out and relaunch Cypress, it'll go back to normal. It is appears to happen whenever ~60 seconds has passed in the test; The website is still responsive (can navigate to a different page within the same test) and does not display a 500 code when going through normal navigation in the Cypress browser.

jennifer-shehane commented 5 years ago

Unfortunately we'll have to close this issue if no reproducible example is provided. Can anyone provide a way to reproduce this?

mabedan commented 5 years ago

I strongly advice against brushing this issue under the rug. This is obviously not an isolated case, as there're many who report the same issue, in this and other threads. I think this is also tied to https://github.com/cypress-io/cypress/issues/1039 , https://github.com/cypress-io/cypress/issues/2938 and https://github.com/cypress-io/cypress/issues/2639 . It has to have something to do with the way cypress channels the requests through.

If not solved, this will occur for future users and Cypress can not become a reliable solution for testing large platforms.

jennifer-shehane commented 5 years ago

@mabedan I agree! We definitely want to fix these issues, especially one as strange sounding as this, but we need a reproducible example to begin tracking it down.

We are also always willing to reopen issues after closing if someone provides an example. We just have to clean up the issues eventually for our sanity. 🙃

Moejoe90 commented 5 years ago

Just an advice if you clone your repo again for some reason everything works

Deleting the cypress cache didn't work Deleting the node_modules didn't work

Cloning a new project worked

charanyarepo commented 4 years ago

Hi team, was there a resolution for this issue, we are facing the same quiet consistently. Especially in the past week.

jennifer-shehane commented 4 years ago

If you're experiencing a bug similar to this in Cypress, please comment in the issue with a fully reproducible example that we can run.

dclowd9901 commented 3 years ago

@jennifer-shehane if we were able to fully and reliably replicate the issue, we wouldn't need the Cypress team to help fix it.

Could you provide maybe some possible places to look or log? We're seeing the issue, and it seems to be originating from Cypress. The 500 error message page is a cypress-owned and presented page, not one of ours.

jennifer-shehane commented 3 years ago

The 500 error message page is a cypress-owned and presented page, not one of ours.

Could you explain what you mean by this? Are you visiting one of Cypress's domains? We don't present any 500 error messages within the application under test itself.

We do proxy requests and there is logic behind that - so it is definitely possible there is a bug in Cypress. If we can't reproduce it, we have no idea where it could be originating from or how to fix it.

dclowd9901 commented 3 years ago

https://github.com/cypress-io/cypress/issues/2218#issuecomment-861520038

It appears to be expressed by the cypress application itself. Here's a screen shot:

cypress-screenshot

That isn't one of our 500 pages. Where in the code does the proxy logic live?

jennifer-shehane commented 3 years ago

@dclowd9901 Yah the state of this error is a bit unusual. Usually an error would be shown in the visit command on the left and the url is not blank within the application under test. It looks like it's still in a loading state.

Is this a screenshot from a video? It may be cutting off the final moments where it shows the error. If you can recreate this locally, is there anything shown in the DevTools console? Or an error printed to stdout? Or do you have any code overwriting Cypress listeners/commands?

TasnimZuhod commented 3 years ago

This happens with me frequently, I usually need to restart Cypress several times in order to proceed with execution

albertmir commented 2 years ago

This randomly happens to us as well: cypress-random-500-error

We've never experienced those 500 errors while using the site we're testing or running the tests locally. It only happens on the CI server.

MaaikeFox commented 2 years ago

We have the same issue I have a video recording of it Does this help @jennifer-shehane ?

https://user-images.githubusercontent.com/40559625/158431694-7b6c0e19-0e76-439d-b378-a6cc3f0e351a.mp4

burkedavid commented 2 years ago

Exactly the same issue is happening in my tests near every time now. Is there a workaround The odd occasion it will pass.

image

finnef commented 2 years ago

I have the same problem running my tests. It mostly occurs after a few longer tests have been run (in Gitlab CI). At some point cy.visit() will return a 500 error.

alectrocute commented 1 year ago

@jennifer-shehane It's very difficult to provide a sample of this bug since it only occurs on CI. I can attest that this bug is still present and seemingly random.

ckifer commented 11 months ago

Can also confirm this still happens and only in CI

Haven't seen anyone else post the stack so:

      at <unknown> ({url}/__cypress/runner/cypress_runner.js:138231:84)
      at visitFailedByErr ({url}/__cypress/runner/cypress_runner.js:137639:12)
      at <unknown> ({url}/__cypress/runner/cypress_runner.js:138214:13)
      at tryCatcher ({url}v/__cypress/runner/cypress_runner.js:8914:23)
      at Promise._settlePromiseFromHandler ({url}/__cypress/runner/cypress_runner.js:6849:31)
      at Promise._settlePromise ({url}/__cypress/runner/cypress_runner.js:6906:18)
      at Promise._settlePromise0 ({url}/__cypress/runner/cypress_runner.js:6951:10)
      at Promise._settlePromises ({url}/__cypress/runner/cypress_runner.js:7027:18)
      at _drainQueueStep ({url}/__cypress/runner/cypress_runner.js:3621:12)
      at _drainQueue ({url}/__cypress/runner/cypress_runner.js:3614:9)
      at ../../node_modules/bluebird/js/release/async.js.Async._drainQueues ({url}/__cypress/runner/cypress_runner.js:3630:5)
      at Async.drainQueues ({url}/__cypress/runner/cypress_runner.js:3500:14)
gauthierm commented 9 months ago

This is happening in CI for us as well. I see this issue is closed but it does not appear to be fixed.

Screen Shot 2023-11-29 at 10 53 42

jennifer-shehane commented 9 months ago

@gauthierm It likely isn't fixed. We need a reproducible example in order to investigate.

markhermano commented 8 months ago

I got the same issue and I'm running the command below in Github Actions.

docker run -i -v $PWD:/e2e -w /e2e --network=host --ipc=host cypress/included:13.6.2
agusbrand commented 5 months ago

I started to experience this issue after upgrading Rails from v7.0 to v7.1. It only happens on Github Actions, specs pass locally

shwetakanchanv788344 commented 3 weeks ago

Have we got a resolution for this issue yet? Even I have been experiencing this on my CI platform and it does not occur locally. I am quite sure this has something to do with proxy.

Also I do see this error in the logs: Failed to call method: org.freedesktop.portal.Settings.Read: object_path= /org/freedesktop/portal/desktop: unknown error type