question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

'Failed to fetch' error when calling fetch in `cypress run`

See original GitHub issue

Current behavior:

Getting Failed to fetch error when running cypress run and visiting a website in https. I’m not getting this error when running in cypress open and also not when running in http websites.

Desired behavior:

Not to get this error.

Steps to reproduce:

I made one commit to demonstrate the problem in the following fork and branch: https://github.com/amitzur/cypress-test-tiny/tree/fetch_issue

I’m calling fetch inside a custom command to a local webserver launched in a cypress plugin.

Versions

This happens on both Cypress version 2.1.0 and 3.0.1

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
jennifer-shehanecommented, Jun 27, 2018

Honestly, I’m not sure about where the difference originates. I believe you should be able to set chromeWebSecurity to false in your cypress.json if you want to ignore this error in your tests though.

{
  "chromeWebSecurity": false
}
0reactions
VigneshTrantorcommented, Nov 10, 2020

Why was this closed? It doesn’t seem like the original bug was fixed. I’m experiencing this issue as well and would like to avoid disabling chromeWebSecurity if possible.

Have you managed to solve it ? I am facing the same problem too

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cypress Code coverage within docker: failed to Fetch error
It looks like it might be coming from the cy.request() that fetches backend coverage, here. code-coverage/support.js
Read more >
Error Messages | Cypress Documentation
This message means that Cypress was unable to find tests in the specified file. You'll likely get this message if you have an...
Read more >
cypress-io/cypress - Gitter
cypress "cannot see" fetch request that it is why we need to remove it from window or add polyfill, to make all request...
Read more >
Fetch API gotcha in cypress.io and how to fix it.
The problem: When you use the fetch API on the client side, you cannot stub routes in cypress.io because of the lack in...
Read more >
TypeError: Failed to fetch and CORS in JavaScript | bobbyhadz
An incorrect or incomplete URL has been passed to the fetch() method. · The server you are making a request to does not...
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