Skip to content

[BUG] /tmp/chromium: error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory #254

Description

@pranavburnwal

I am using the AWS layer method.
Already checked all existing issues for similarity.
Please see the screenshot below for more debugging and details.
getAllFilesAndFolders gets all files and prints them in an array.

Environment

  • chromium Version: 122.0.0
  • puppeteer / puppeteer-core Version: 22.5.0
  • Node.js Version: 18.x
  • Lambda / GCF Runtime: nodejs18.x

FYI Previously has tried: chromium:118.0 / puppeteer:21.4 - Same issue
My codebase is serverless typescript, which gets compiled by webpack and deployed.

Expected Behavior

Code should just run.

Current Behavior

Screenshot 2024-04-04 at 9 29 28 PM

Steps to Reproduce

			console.log("AWS_EXECUTION_ENV: "+process.env.AWS_EXECUTION_ENV)
            console.log('defaultPuppeteerTest> before ')
            console.log(await getAllFilesAndFolders('/tmp'));
            console.log(await getAllFilesAndFolders('/opt/nodejs/node_modules/@sparticuz/chromium'));
            chromium.setHeadlessMode = true;
            chromium.setGraphicsMode = false
            const executablePath = config.ENVIRONMENT === 'dev'
                ? config.CHROMIUM
                : await chromium.executablePath("/opt/nodejs/node_modules/@sparticuz/chromium/bin");
            
            console.log('defaultPuppeteerTest> after executablePath')
            console.log(await getAllFilesAndFolders('/tmp'));
            console.log(await getAllFilesAndFolders('/opt/nodejs/node_modules/@sparticuz/chromium'));
            let browser = await puppeteer.launch({
                args: config.ENVIRONMENT === 'dev' ? puppeteer.defaultArgs() : ['--disable-extensions', ...chromium.args],
                executablePath: executablePath,
                defaultViewport: {
                    width: 3839,
                    height: 2160,
                    deviceScaleFactor: 2
                },
                env: {
                    TZ: "Asia/Singapore",
                },

                ignoreHTTPSErrors: true,
            });
            const page = await browser.newPage();
            await page.goto("https://example.com");
            const pageTitle = await page.title();
            await browser.close();

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions