cypress-file-upload icon indicating copy to clipboard operation
cypress-file-upload copied to clipboard

[Bug] I cannot upload large files

Open amartinez1558 opened this issue 4 years ago • 8 comments

Current behavior:

I have a file that's 100MBs in size. It seems that the cy.fixture is trying to load this into memory before attaching to target input. It seems that this plugin doesn't play well with large files. Can you think of any workaround? Thanks!

Desired behavior:

I should be able to upload 100MB to 1GB files without delay.

Steps to reproduce: (app code and test code)

cy.get('#uploadInput') .attachFile('100MB-File');

=> either a timeout issue or the following Invalid string length

image

Versions

Cypress v6.3.0 Cypress File Upload v5.0.2

amartinez1558 avatar Feb 10 '21 22:02 amartinez1558

Having the same issue though the error is slightly different (~500MB .csv file):

image

"@testing-library/cypress": "^7.0.6",
"clipboardy": "^2.3.0",
"cypress": "^7.4.0",
"cypress-cucumber-preprocessor": "^4.1.0",
"cypress-file-upload": "^5.0.7"

The error occurs in Cypress.cy.fixture(filePath, fileEncoding)

Relates to ? https://github.com/cypress-io/cypress/issues/16823

LoganWlv avatar Jun 07 '21 07:06 LoganWlv

This is still an issue and has nothing to do with the server side. How can this be down by a workaround? I try it with a one Gb file. This is working well in production but not with cypress. Is it possible to trigger the change event of the input type file?

sprotznock85 avatar Sep 11 '21 05:09 sprotznock85

Really need a workaround on this bug. Cannot use cypress otherwise. Any help?

sprotznock85 avatar Sep 16 '21 13:09 sprotznock85

I also need this.

adammfrank avatar Mar 03 '22 07:03 adammfrank

I also stumbled now over this and it would be nice to have a workaround for that

Wheedman avatar Jul 29 '22 08:07 Wheedman

October 2023... Issue still not solved. I need to upload files approx 500 MB... Anybody solved or find workaround?

vvip-68 avatar Oct 10 '23 18:10 vvip-68

This is likely a Node.js limitation. Node.js serves as the underlying runtime for Cypress and imposes constraints on string sizes to prevent excessive memory consumption. Unfortunately, this limit is not easily adjustable.

To tackle this issue, you might need to consider the following approaches:

Upload Smaller Chunks:

  • If you're attempting to upload a rather large file (500 MB+), consider breaking it into smaller chunks and uploading them sequentially rather than as a single large file.

Use an Alternative Method:

  • Depending on your specific use case, you may discover an alternative approach for uploading or processing large files, such as streaming the data instead of holding it in memory.

My team and I are currently exploring these options, and if we find a workaround for this issue, I will share it here!

Ralkage avatar Oct 19 '23 03:10 Ralkage

FYI, we haven't found a workaround for this specific issue yet. A colleague who's assisting us in finding a possible solution came across this StackOverflow post that might shed light on why we're facing challenges when working with large files in Cypress. It's worth noting that this issue doesn't occur on my other colleague's machine, who uses MacOS on his Macbook M1. Our team continues to investigate potential workarounds, but at this moment, we haven't discovered an alternative for handling file uploads of 500 MB or more using Cypress on Windows or Linux machines.

Ralkage avatar Nov 01 '23 00:11 Ralkage