Error: Failed to parse or set cookie named

See original GitHub issue

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.

Issue Analytics

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

github_iconTop GitHub Comments

4reactions
rafael-anachoretacommented, Mar 1, 2019

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

0reactions
jennifer-shehanecommented, Dec 9, 2020

Since this issue hasn’t had activity in over a year, we’ll close the issue until we can confirm this is still happening.

Please comment if there is new information to provide concerning the original issue and we’d be happy to reopen.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cypress Error: Failed to parse or set cookie named
We received this error at the network level: Error: Failed to parse or set cookie named "cookie-name". The stack trace is as follows:...
Read more >
56211 - chrome.cookies fails for localhost domains - Monorail
Call chrome.cookies.set({domain: "localhost", name: "foo", value: "bar", ... Get: Error during cookies.set: Failed to parse or set cookie named "foo".
Read more >
Edit-This-Cookie - Bountysource
Failed to create a new cookie with error "Unchecked runtime.lastError: Failed to parse or set cookie named [new cookie name]" $ 0 ·...
Read more >
Troubleshooting AWS IoT Greengrass
Error : Failed to parse /<greengrass-root>/config/config.json. ... Set the postStartHealthCheckTimeout property in the Greengrass configuration file.
Read more >
Issue 31456: SimpleCookie fails to parse any cookie if an ...
from http.cookies import SimpleCookie >>> cookie_string = "ASDF=stuff; ... print(BaseCookie('first=morsel second=morsel')) Set-Cookie: ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found