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.

[BUG] `ERR_FS_FILE_TOO_LARGE` when trying to upload a file bigger than 2GB

See original GitHub issue

Context:

  • Playwright Version: 1.17.1
  • Operating System: Windows 11
  • Node.js version: 16.13.0
  • Browser: Chromium

Code Snippet

const {chromium} = require('playwright');

(async () => {
  const browser = await chromium.launch();
  const context = await browser.newContext();

  await context.clearCookies();
  await context.addCookies(cookies);

  const page = await context.newPage();

  await page.goto("https://www.youtube.com/channel_switcher");

  await page.click(`text=${channel.youtubeChannelName}`);

  await page.goto("https://studio.youtube.com/");

  await page.click('ytcp-button[role="button"]:has-text("Create")');
  await page.click("text=Upload videos");

  await page.click('ytcp-button[role="button"]:has-text("Select files")');

  await page.setInputFiles(
    'ytcp-button[role="button"]:has-text("Select files")',
    videoToUpload
  ); // triggers error
})();

Describe the bug

The following error appears:

page.setInputFiles: File size (5935778423) is greater than 2 GB

Alternative that also doesn’t work

I also tested like this and I get the same error:

const [fileChooser] = await Promise.all([
  page.waitForEvent("filechooser"),
  page.click('ytcp-button[role="button"]:has-text("Select files")'),
]);
await fileChooser.setFiles(videoToUpload);

My own investigation

This error only happens when I use the code from playwright for uploading. But if I use a await page.pause() and select the file manually on the File Chooser, the upload works.

From what I understand from the error, is that Playwright will load the file on Node memory (notice FS on the error code) and try to send it to the File Chooser from a Buffer or something similar. But why can’t I just send a path to the File Chooser instead of loading it on the memory?

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
aslushnikovcommented, Jan 31, 2022

@italodeandra this is actually a dupe of #3768. And good news, #3768 is now prioritized!

So I’ll close this as a dupe.

0reactions
laviniaSer07commented, May 3, 2022

Hello! I’m still getting this error when I am trying to upload a file grater then 2 GB RangeError [ERR_FS_FILE_TOO_LARGE]: File size (3235260344) is greater than 2 GB. Is there any update for the files that are larger than 2GB ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

When a large file upload exceeds the 2GB limit, do I expect ...
The error message I'm getting is "One or More Files Failed to Upload". Is this because the file size is too large or...
Read more >
Unable to upload software image larger than 2GB using ...
When attempting to import a software image file over 2GB in size via Configuration Utility (GUI), it may not show any progress in...
Read more >
Cannot upload files larger than 2Gb - Server
Whenever I try to upload a file that is larger than 2Gb I get an error like "Error uploading file "four": Internal Server...
Read more >
Copying files exceeding 2 GB fails - Windows Server
When you try to copy a file larger than 2 GB by using Remote Desktop Protocol (RDP) client 6.0 or later, the file...
Read more >
Upload a huge file ~2GB size causes browser error
I'm not sure that I would re-invent the wheel by trying to chunk the file yourself. Look into an AngularJS file upload library...
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