cypress icon indicating copy to clipboard operation
cypress copied to clipboard

getting random http response code 500

Open ainglese opened this issue 7 years ago • 28 comments

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 avatar Jul 27 '18 08:07 ainglese

addendum, please note that:

  • The requests, consistently runs without errors when simulating requests with postman or other tools. so i think it's not becouse of application specific errors.
  • Those static files, do non require authentication. so i don't think that exeptions are related to our application using basic instead of a cookie for authentication.
  • Since cypress gives no error when using forms authentication, i think i can exclude something in the response content (things like gzip compression, UTF-8 encoding) etc.
  • those assets are all UTF-8 encoded with BOM

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.

ainglese avatar Jul 27 '18 08:07 ainglese

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.

Francis-Moreau-adsk avatar Sep 26 '18 14:09 Francis-Moreau-adsk

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...

mabedan avatar Dec 12 '18 15:12 mabedan

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

jennifer-shehane avatar Dec 27 '18 08:12 jennifer-shehane

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.

ADavisDon avatar Jan 02 '19 21:01 ADavisDon

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

jennifer-shehane avatar Jan 14 '19 08:01 jennifer-shehane

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.

mabedan avatar Jan 14 '19 09:01 mabedan

@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. 🙃

jennifer-shehane avatar Jan 30 '19 06:01 jennifer-shehane

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

Moejoe90 avatar Jun 12 '19 10:06 Moejoe90

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

charanyarepo avatar Apr 22 '20 02:04 charanyarepo

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.

jennifer-shehane avatar Apr 23 '20 06:04 jennifer-shehane

@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.

dclowd9901 avatar Jun 14 '21 21:06 dclowd9901

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.

jennifer-shehane avatar Jun 15 '21 13:06 jennifer-shehane

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?

dclowd9901 avatar Jun 15 '21 15:06 dclowd9901

@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?

jennifer-shehane avatar Jun 15 '21 18:06 jennifer-shehane

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

TasnimZuhod avatar Jul 01 '21 12:07 TasnimZuhod

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.

albertmir avatar Nov 09 '21 06:11 albertmir

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

MaaikeFox avatar Mar 15 '22 17:03 MaaikeFox

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

image

burkedavid avatar Mar 25 '22 14:03 burkedavid

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.

finnef avatar May 24 '22 12:05 finnef

@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.

alectrocute avatar Sep 11 '23 21:09 alectrocute

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)

ckifer avatar Oct 11 '23 17:10 ckifer

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

gauthierm avatar Nov 29 '23 14:11 gauthierm

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

jennifer-shehane avatar Nov 29 '23 15:11 jennifer-shehane

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

markhermano avatar Jan 08 '24 07:01 markhermano

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

agusbrand avatar Mar 29 '24 16:03 agusbrand

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

shwetakanchanv788344 avatar Aug 18 '24 13:08 shwetakanchanv788344

This issue has not had any activity in 180 days. Cypress evolves quickly and the reported behavior should be tested on the latest version of Cypress to verify the behavior is still occurring. It will be closed in 14 days if no updates are provided.

cypress-app-bot avatar Feb 15 '25 01:02 cypress-app-bot

This issue has been closed due to inactivity.

cypress-app-bot avatar Mar 01 '25 02:03 cypress-app-bot