Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Puppeteer v19 Failure #7

Open
timstarbuck-boystown opened this issue Jan 16, 2023 · 5 comments
Open

Puppeteer v19 Failure #7

timstarbuck-boystown opened this issue Jan 16, 2023 · 5 comments

Comments

@timstarbuck-boystown
Copy link

Thanks for putting together this example repo!

I noticed it fails with the latest puppeteer version 19.x (works fine with 18.2.1).

The docs show a breaking change to the default download location.

I tried setting the cache var according to the docs but didn't have any success.

Wondering if anyone has found a way to make this work with the latest puppeteer version?

Exception: Could not find Chromium (rev. 1069273). This can occur if either
 1. you did not perform an installation before running the script (e.g. `npm install`) or
 2. your cache path is incorrectly configured (which is: /home/.cache/puppeteer).
For (2), check out our guide on configuring puppeteer at https://pptr.dev/guides/configuration.
Stack: Error: Could not find Chromium (rev. 1069273). This can occur if either
 1. you did not perform an installation before running the script (e.g. `npm install`) or
 2. your cache path is incorrectly configured (which is: /home/.cache/puppeteer).
For (2), check out our guide on configuring puppeteer at https://pptr.dev/guides/configuration.
    at ChromeLauncher.resolveExecutablePath (/home/site/wwwroot/node_modules/puppeteer-core/lib/cjs/puppeteer/node/ProductLauncher.js:119:27)
    at ChromeLauncher.executablePath (/home/site/wwwroot/node_modules/puppeteer-core/lib/cjs/puppeteer/node/ChromeLauncher.js:205:25)
    at ChromeLauncher.launch (/home/site/wwwroot/node_modules/puppeteer-core/lib/cjs/puppeteer/node/ChromeLauncher.js:93:37)
    at async module.exports (/home/site/wwwroot/screenshot/index.js:5:21)
@joelbyler
Copy link

same issue here, following along but will update if I find anything useful

@anthonychu
Copy link
Owner

@timstarbuck-boystown You're right. Looks like Puppeteer changed the default location they download the browser binaries to.

I think previously it downloaded the binaries to the app's node_modules folder. It now downloads it to ~/.cache. Because the function app package is generated by basically zipping up the function app folder (folder containing host.json), the binaries are no longer included in the deployment package.

The fix for this, assuming you're following the remote build method outlined here, is to add an app setting to your function app in Azure named PUPPETEER_CACHE_DIR and set it to /home/site/wwwroot or /home/site/wwwroot/.cache. This sets an environment variable during both the remote build and at run time, so that npm install installs the binaries into a location within the function app folder and Puppeteer loads the binaries from the same place when it's executing.

@maiajhonathan
Copy link

maiajhonathan commented Mar 1, 2023

@anthonychu
@joelbyler
I keep getting the error:
2023-03-01T04:25:00Z [Error] Something went wrong and the scheduler was forced to exit.
Details: Error: Could not find Chromium (rev. 1095492). This can occur if either

  1. you did not perform an installation before running the script (e.g. npm install) or
  2. your cache path is incorrectly configured (which is: /home/site/wwwroot/.cache).
    For (2), check out our guide on configuring puppeteer at https://pptr.dev/guides/configuration.

Running nodejs + typescript on Linux
The publish script does not log anything in regards to the packages it is installing so I can't check if Chromium or even puppeteer has actually being installed.

PUBLISH LOGS:
Uploading 52.42 MB [##############################################################################]
Remote build in progress, please wait...
Updating submodules.
Preparing deployment for commit id 'a5eb6160-0'.
PreDeployment: context.CleanOutputPath False
PreDeployment: context.OutputPath /home/site/wwwroot
Repository path is /tmp/zipdeploy/extracted
Running oryx build...
Command: oryx build /tmp/zipdeploy/extracted -o /home/site/wwwroot --platform nodejs --platform-version ~14
Operation performed by Microsoft Oryx, https://github.com/Microsoft/Oryx
You can report issues at https://github.com/Microsoft/Oryx/issues

Oryx Version: 0.2.20210120.1, Commit: 66c7820d7df527aaffabd2563a49ad57930999c9, ReleaseTagName: 20210120.1

Build Operation ID: |Y1w48IbZ+Zc=.20280127_
Repository Commit : a5eb6160-0743-4bb4-b9e6-f880de809422

Detecting platforms...
Detected following platforms:
nodejs: 14.19.1
python: 3.8.16
Version '14.19.1' of platform 'nodejs' is not installed. Generating script to install it...
Version '3.8.16' of platform 'python' is not installed. Generating script to install it...

Source directory : /tmp/zipdeploy/extracted
Destination directory: /home/site/wwwroot

Downloading and extracting 'nodejs' version '14.19.1' to '/tmp/oryx/platforms/nodejs/14.19.1'...
Downloaded in 0 sec(s).
Verifying checksum...
Extracting contents...
Done in 2 sec(s).

Downloading and extracting 'python' version '3.8.16' to '/tmp/oryx/platforms/python/3.8.16'...
Downloaded in 1 sec(s).
Verifying checksum...
Extracting contents...
Done in 5 sec(s).

Using Node version:
v14.19.1

Using Npm version:
6.14.16

Running 'npm install --unsafe-perm'...

npm WARN ts-mock-imports@1.3.8 requires a peer of sinon@>= 4.1.2 but none is installed. You must install peer dependencies yourself.
npm WARN linux-report@1.0.0 No description
npm WARN linux-report@1.0.0 No repository field.
npm WARN linux-report@1.0.0 No license field.

up to date in 4.214s

64 packages are looking for funding
run npm fund for details

Running 'npm run build'...

linux-report@1.0.0 build /tmp/zipdeploy/extracted
./node_modules/typescript/bin/tsc

Preparing output...

Copying files to destination directory '/home/site/wwwroot'...
Done in 6 sec(s).

Removing existing manifest file
Creating a manifest file...
Manifest file created.

Done in 32 sec(s).
Running post deployment command(s)...

Generating summary of Oryx build
Deployment Log file does not exist in /tmp/oryx-build.log
The logfile at /tmp/oryx-build.log is empty. Unable to fetch the summary of build
Triggering recycle (preview mode disabled).
Linux Consumption plan has a 1.5 GB memory limit on a remote build container.
To check our service limit, please visit https://docs.microsoft.com/en-us/azure/azure-functions/functions-scale#service-limits
Writing the artifacts to a squashfs file
Parallel mksquashfs: Using 1 processor
Creating 4.0 filesystem on /home/site/artifacts/functionappartifact.squashfs, block size 131072.

[=======================================================\ ] 24400/25790 94%
[===========================================================|] 25790/25790 100%

Exportable Squashfs 4.0 filesystem, gzip compressed, data block size 131072
compressed data, compressed metadata, compressed fragments, compressed xattrs
duplicates are removed
Filesystem size 38609.73 Kbytes (37.70 Mbytes)
17.87% of uncompressed filesystem size (216092.93 Kbytes)
Inode table size 247598 bytes (241.79 Kbytes)
27.75% of uncompressed inode table size (892404 bytes)
Directory table size 253846 bytes (247.90 Kbytes)
38.73% of uncompressed directory table size (655448 bytes)
Number of duplicate files found 3984
Number of inodes 27744
Number of files 24940
Number of fragments 744
Number of symbolic links 0
Number of device nodes 0
Number of fifo nodes 0
Number of socket nodes 0
Number of directories 2804
Number of ids (unique uids + gids) 1
Number of uids 1
root (0)
Number of gids 1
root (0)
Creating placeholder blob for linux consumption function app...
SCM_RUN_FROM_PACKAGE placeholder blob scm-latest-report-linux.zip located
Uploading built content /home/site/artifacts/functionappartifact.squashfs for linux consumption function app...
Resetting all workers for report-linux.azurewebsites.net
Deployment successful. deployer = Push-Deployer deploymentPath = Functions App ZipDeploy. Extract zip. Remote build.
Remote build succeeded!
Syncing triggers...
Functions in report-linux:
report-scheduler - [timerTrigger]

Does anyone know what I might be missing?

@maiajhonathan
Copy link

maiajhonathan commented Mar 21, 2023

Anyone? Any news?

@LeoneldeBarros
Copy link

LeoneldeBarros commented Jun 1, 2023

hello i found the solution ,
you have to add this file to force the cache directory ( https://pptr.dev/guides/configuration )

.puppeteerrc.cjs

`const {join} = require('path');

/**

  • @type {import("puppeteer").Configuration}
    */
    module.exports = {
    // Changes the cache location for Puppeteer.
    cacheDirectory: join(__dirname, '.cache', 'puppeteer'),
    };`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants