Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File download crashes Cypress #18972

Closed
ayzu opened this issue Nov 18, 2021 · 5 comments
Closed

File download crashes Cypress #18972

ayzu opened this issue Nov 18, 2021 · 5 comments
Labels
stage: needs information Not enough info to reproduce the issue

Comments

@ayzu
Copy link

ayzu commented Nov 18, 2021

Current behaviour

Cypress crashes when downloads a file.

Error: ERR_FAILED (-2) loading 'http://localhost:8080/ui/chile/files/669'
    at rejectAndCleanup (node:electron/js2c/browser_init:165:7486)
    at Object.stopLoadingListener (node:electron/js2c/browser_init:165:7861)
    at Object.emit (node:events:394:28)
 {
  errno: -2,
  code: 'ERR_FAILED',
  url: 'http://localhost:8080/ui/chile/files/669'
}
Error: ERR_FAILED (-2) loading 'http://localhost:8080/ui/chile/files/669'
    at rejectAndCleanup (node:electron/js2c/browser_init:165:7486)
    at Object.stopLoadingListener (node:electron/js2c/browser_init:165:7861)
    at Object.emit (node:events:394:28)

Desired behaviour

Cypress should download the file successfully.

Test code to reproduce

  it.only("Crashes", function () {
    cy.visit("http://localhost:8080/ui/chile/file-history");
    cy.get("[data-cy=download-btn]").click();
  });

HTML:

<body><a href="/ui/chile/files/669" target="_blank" data-cy="download-btn" style="user-select: auto;">Link</a></body>

I run the server-side code using Golang.

Cypress Version

9.0.0.

Other

The issue is similar to #18547

The difference is in the cypress version: 9.0.0 in my case vs 8.6.0 in the previous issue.
Another difference is the superdomain: the same domain for the download link (localhost) in my case vs the external domain in the previous issue.

@ayzu ayzu changed the title File download crashes File download crashes Cypress Nov 18, 2021
@chrisbreiding
Copy link
Contributor

Can you provide the following information?

  • OS
  • OS version
  • Browser
  • Browser version

Also, it will be difficult for us to reproduce this issue with the steps provided, as it would require setting up a Golang server and there might be other configuration that influences the issue. If possible, could you create a fork of cypress-test-tiny that reproduces the issue. It would go a long way in helping us to fix this issue. Thanks!

@chrisbreiding chrisbreiding added the stage: needs information Not enough info to reproduce the issue label Nov 23, 2021
@ayzu
Copy link
Author

ayzu commented Nov 25, 2021

Can you provide the following information?

  • OS
  • OS version
  • Browser
  • Browser version

Also, it will be difficult for us to reproduce this issue with the steps provided, as it would require setting up a Golang server and there might be other configuration that influences the issue. If possible, could you create a fork of cypress-test-tiny that reproduces the issue. It would go a long way in helping us to fix this issue. Thanks!

Thank you for your reply!

Here is an output from cypress info:

cypress info
Displaying Cypress info...

Detected 2 browsers installed:

1. Chrome
  - Name: chrome
  - Channel: stable
  - Version: 92.0.4515.159
  - Executable: google-chrome-stable
  - Profile: /home/aynur/.config/Cypress/cy/production/browsers/chrome-stable

2. Firefox
  - Name: firefox
  - Channel: stable
  - Version: 93.0
  - Executable: firefox

Note: to run these browsers, pass <name>:<channel> to the '--browser' field

Examples:
- cypress run --browser chrome
- cypress run --browser firefox

Learn More: https://on.cypress.io/launching-browsers

Proxy Settings: none detected
Environment Variables: none detected

Application Data: /home/aynur/.config/cypress/cy/development
Browser Profiles: /home/aynur/.config/cypress/cy/development/browsers
Binary Caches: /home/aynur/.cache/Cypress

Cypress Version: 9.1.0
System Platform: linux (Manjaro Linux - 21.1.6)

@ayzu
Copy link
Author

ayzu commented Dec 1, 2021

Hey @chrisbreiding

I think I found the root cause. Cypress crashes when it tries to download a file from the anchor with target=_blank attribute. If I remove it, the file is downloaded successfully.

@archfz
Copy link

archfz commented Nov 2, 2022

For me it hangs when I remove the target blank attribute. In cypress 10.10.0

@flotwig
Copy link
Contributor

flotwig commented Feb 27, 2023

This is seemingly a duplicate of #18547, closing

@flotwig flotwig closed this as completed Feb 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stage: needs information Not enough info to reproduce the issue
Projects
None yet
Development

No branches or pull requests

4 participants