cypress: Error: Failed to parse or set cookie named

Current behavior:

When using a cookie with attribute Secure using a HTTP connection an error is thrown and tests are aborted:

Error: Failed to parse or set cookie named “<JSESSIONID>”.

For more context, see https://github.com/cypress-io/cypress/issues/1321#issuecomment-462647518

Desired behavior:

Cypress should continue to run tests and ignore cookie, perhaps showing a warning about trying to set a secure cookie on a non-secure connection.

Steps to reproduce: (app code and test code)

  1. Use a non-encrypted connection (http)
  2. Navigate Cypress to a url which tries to set a Secure cookie as response

Versions

Cypress 3.1.5 (3.1.0 works fine), any OS, both Electron and Chrome are affected.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 8
  • Comments: 15 (4 by maintainers)

Most upvoted comments

@jennifer-shehane I would like to re-open this issue as I am unable to catch the exception using uncaught:exception and Cypress just straight up crashes when the set cookie error occurs. This halts all execution, which I think is pretty bad.

support/index.js

Cypress.on('uncaught:exception', () => {
  return false;
});

Run

$ cypress run

====================================================================================================

  (Run Starting)

  ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
  │ Cypress:    3.1.1                                                                              │
  │ Browser:    Electron 59 (headless)                                                             │
  │ Specs:      1 found (smokeTest.spec.js)                                                        │
  └────────────────────────────────────────────────────────────────────────────────────────────────┘


────────────────────────────────────────────────────────────────────────────────────────────────────
                                                                                                    
  Running: smokeTest.spec.js...                                                            (1 of 1) 


  Smoke tests
    1) Should render an insecure page
{ Error: Setting cookie failed


  cause: 
   Error: Setting cookie failed
   
   ,
  isOperational: true }
Error: Setting cookie failed


error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

I was able to confirm that this started happening on 3.1.1, so for now I’m going with 3.1.0 as @sweoggy suggested.

Unfortunately I don’t have a reproducible example I can share at this moment 😞