You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Connect to a remote browser that does not share the file system with environment executing the script (could be in a container or another machines)
Try to upload a file using fileChooser.accpet
Fail.
This seems to be due the following code in /puppeteer/lib/cjs/puppeteer/common/JSHandle.js
uploadFile()
.
.
// Locate all files and confirm that they exist.
const files = await Promise.all(filePaths.map(async (filePath) => {
const resolvedPath = path.resolve(filePath);
try {
await fs.promises.access(resolvedPath, fs.constants.R_OK);
}
catch (error) {
if (error.code === 'ENOENT')
throw new Error(${filePath} does not exist or is not readable);
}
return resolvedPath;
}));
This code seems to be trying to access the local file system of where the Puppeteer script is running to determine if the files are present. Since the browser is running on a different file system this does not go well.
There should be some way to tell puppeteer that we are on a remote system and can't just use fs.
Commenting this code out seems to work.
Puppeteer version
12.0.1
Node.js version
16.13
npm version
8.5.0
What operating system are you seeing the problem on?
Linux
Relevant log output
Error: C:\Users\vess\Downloads\download.csv does not exist or is not readable
at /home/vess/dev/addon-puppeteer/node_modules/puppeteer/lib/cjs/puppeteer/common/JSHandle.js:531:27
at async Promise.all (index 0)
at async ElementHandle.uploadFile (/home/vess/dev/addon-puppeteer/node_modules/puppeteer/lib/cjs/puppeteer/common/JSHandle.js:524:23)
at async FileChooser.accept (/home/vess/dev/addon-puppeteer/node_modules/puppeteer/lib/cjs/puppeteer/common/FileChooser.js:61:9)
at async PageController.uploadFile (/home/vess/dev/addon-puppeteer/dist/page/navigate.controller.js:416:13)
at async /home/vess/dev/addon-puppeteer/node_modules/@nestjs/core/router/router-execution-context.js:46:28
at async /home/vess/dev/addon-puppeteer/node_modules/@nestjs/core/router/router-proxy.js:9:17
The text was updated successfully, but these errors were encountered:
Bug description
Steps to reproduce the problem:
This seems to be due the following code in /puppeteer/lib/cjs/puppeteer/common/JSHandle.js
uploadFile()
.
.
// Locate all files and confirm that they exist.
const files = await Promise.all(filePaths.map(async (filePath) => {
const resolvedPath = path.resolve(filePath);
try {
await fs.promises.access(resolvedPath, fs.constants.R_OK);
}
catch (error) {
if (error.code === 'ENOENT')
throw new Error(
${filePath} does not exist or is not readable
);}
return resolvedPath;
}));
This code seems to be trying to access the local file system of where the Puppeteer script is running to determine if the files are present. Since the browser is running on a different file system this does not go well.
There should be some way to tell puppeteer that we are on a remote system and can't just use fs.
Commenting this code out seems to work.
Puppeteer version
12.0.1
Node.js version
16.13
npm version
8.5.0
What operating system are you seeing the problem on?
Linux
Relevant log output
The text was updated successfully, but these errors were encountered: