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] File uploads fail which are > 50 MB

See original GitHub issue

Context:

  • Playwright Version: 1.3.0
  • Operating System: Windows
  • Node.js version: 12.18.3
  • Browser: Chromium

Code Snippet

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

(async () => {
  const browser = await chromium.launch();
  const page = await browser.newPage();
  await page.setContent(
    '<input type="file" name="fileToUpload" id="fileToUpload">'
  );
  await page.setInputFiles("input", "path/to/large/file.txt");
  await browser.close();
})();

Describe the bug When uploading large file, about 100MB, page.setInputFiles fails. With Firefox and Webkit it takes some time but it works. Log:

  pw:api => page.setContent started +0ms
  pw:api setting frame content, waiting until "load" [] +1ms
  pw:api <= page.setContent succeeded +79ms
  pw:api => page.setInputFiles started +2ms
  pw:api waiting for selector "input" [] +1ms
  pw:api   selector resolved to visible <input type="file" id="fileToUpload" name="fileToUpload"/> [] +26ms
  pw:api <= page.setInputFiles failed +1s
(node:19668) UnhandledPromiseRejectionWarning: page.setInputFiles: Protocol error (Runtime.callFunctionOn): Target closed.
=========================== logs ===========================
[api] waiting for selector "input"
[api]   selector resolved to visible <input type="file" id="fileToUpload" name="fileToUpload"/>
============================================================
Note: use DEBUG=pw:api environment variable and rerun to capture Playwright logs.Error
    at C:\dev\playwright\node_modules\playwright\lib\chromium\crConnection.js:131:63
    at new Promise (<anonymous>)
    at CRSession.send (C:\dev\playwright\node_modules\playwright\lib\chromium\crConnection.js:130:16)
    at CRSession.send (C:\dev\playwright\node_modules\playwright\lib\helper.js:80:31)
    at CRExecutionContext.evaluateWithArguments (C:\dev\playwright\node_modules\playwright\lib\chromium\crExecutionContext.js:40:79)
    at evaluateExpression (C:\dev\playwright\node_modules\playwright\lib\javascript.js:164:40)
    at async FrameManager.waitForSignalsCreatedBy (C:\dev\playwright\node_modules\playwright\lib\frames.js:90:24)
    at async FrameExecutionContext.evaluateInternal (C:\dev\playwright\node_modules\playwright\lib\dom.js:36:16)
    at async CRPage.setInputFiles (C:\dev\playwright\node_modules\playwright\lib\chromium\crPage.js:210:9)
    at async C:\dev\playwright\node_modules\playwright\lib\dom.js:440:13
  -- ASYNC --
    at CRSession.send (C:\dev\playwright\node_modules\playwright\lib\helper.js:79:23)
    at CRExecutionContext.evaluateWithArguments (C:\dev\playwright\node_modules\playwright\lib\chromium\crExecutionContext.js:40:79)
    at evaluateExpression (C:\dev\playwright\node_modules\playwright\lib\javascript.js:164:40)
    at async FrameManager.waitForSignalsCreatedBy (C:\dev\playwright\node_modules\playwright\lib\frames.js:90:24)
    at async FrameExecutionContext.evaluateInternal (C:\dev\playwright\node_modules\playwright\lib\dom.js:36:16)
    at async CRPage.setInputFiles (C:\dev\playwright\node_modules\playwright\lib\chromium\crPage.js:210:9)
    at async C:\dev\playwright\node_modules\playwright\lib\dom.js:440:13
    at async FrameManager.waitForSignalsCreatedBy (C:\dev\playwright\node_modules\playwright\lib\frames.js:90:24)
    at async ElementHandle._setInputFiles (C:\dev\playwright\node_modules\playwright\lib\dom.js:438:9)
    at async C:\dev\playwright\node_modules\playwright\lib\frames.js:674:32
  -- ASYNC --
    at Frame.setInputFiles (C:\dev\playwright\node_modules\playwright\lib\helper.js:79:23)
    at C:\dev\playwright\node_modules\playwright\lib\page.js:407:61
    at Page._attributeToPage (C:\dev\playwright\node_modules\playwright\lib\page.js:370:20)
    at Page.setInputFiles (C:\dev\playwright\node_modules\playwright\lib\page.js:407:21)
    at Page.setInputFiles (C:\dev\playwright\node_modules\playwright\lib\helper.js:80:31)
    at C:\dev\playwright\upload.js:9:14
(node:19668) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:19668) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:56
  • Comments:39 (6 by maintainers)

github_iconTop GitHub Comments

9reactions
pavelfeldmancommented, Nov 15, 2021

I’m trying to prioritize this, could you share what kind of testing scenario requires uploading 100Mb+ files?

6reactions
Vanish404commented, Nov 1, 2021

hey, any updates?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to upload files with size larger than 50 MB but smaller ...
Open IIS->Advanced Settings->Under Connections Time-out, type the number of seconds that you want in the Connection Time-out box.
Read more >
How to Fix the uploaded file exceeds the upload_max_filesize ...
A step-by-step guide for how to fix the "the uploaded file exceeds the upload_max_filesize directive in php.ini" error in WordPress.
Read more >
CSCvn01551 - Failed to upload AC packages of ... - Cisco Bug
Symptom: Unable to upload newer versions of AnyConnect packages of size more than 50MB Conditions: Need for uploading AnyConnect packages ...
Read more >
Cannot upload large (>50MB) files to document library
The upload single document fails silently, upload multiple just shows a failed message. I've turned up the file size limit on the web...
Read more >
How to Fix the upload_max_filesize Error in WordPress
The quickest fix for the uploaded file exceeds the upload_max_filesize directive in php.ini error is increasing your PHP resource limits by ...
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