mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
docs: update troubleshooting guide for Google Cloud Functions (#11286)
Co-authored-by: Alex Rudenko <OrKoN@users.noreply.github.com> Co-authored-by: Nikolay Vitkov <34244704+Lightning00Blade@users.noreply.github.com> Co-authored-by: Alex Rudenko <alexrudenko@chromium.org>
This commit is contained in:
parent
d0862a11f2
commit
cd5c6820c1
@ -514,22 +514,52 @@ The Node.js runtime of the
|
|||||||
[App Engine standard environment](https://cloud.google.com/appengine/docs/standard/nodejs/)
|
[App Engine standard environment](https://cloud.google.com/appengine/docs/standard/nodejs/)
|
||||||
comes with all system packages needed to run Headless Chrome.
|
comes with all system packages needed to run Headless Chrome.
|
||||||
|
|
||||||
To use `puppeteer`, simply list the module as a dependency in your
|
To use `puppeteer`, specify the module as a dependency in your `package.json`
|
||||||
`package.json` and deploy to Google App Engine. Read more about using
|
and then override the puppeteer cache directory by including a file named
|
||||||
`puppeteer` on App Engine by following
|
`.puppeteerrc.cjs` at the root of your application with the contents:
|
||||||
[the official tutorial](https://cloud.google.com/appengine/docs/standard/nodejs/using-headless-chrome-with-puppeteer).
|
|
||||||
|
```ts
|
||||||
|
const {join} = require('path');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {import("puppeteer").Configuration}
|
||||||
|
*/
|
||||||
|
module.exports = {
|
||||||
|
cacheDirectory: join(__dirname, 'node_modules', '.puppeteer_cache'),
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
|
> Google App Engine caches your `node_modules` between builds.
|
||||||
|
> Specifying the Puppeteer cache as subdirectory of `node_modules`
|
||||||
|
> mitigates an issue in which Puppeteer can't find the browser executable
|
||||||
|
> due to `postinstall` not being run.
|
||||||
|
|
||||||
### Running Puppeteer on Google Cloud Functions
|
### Running Puppeteer on Google Cloud Functions
|
||||||
|
|
||||||
You can try running Puppeteer on
|
The Node.js runtime of
|
||||||
[Google Cloud Functions](https://cloud.google.com/functions/docs/) but we have
|
[Google Cloud Functions](https://cloud.google.com/functions/docs/)
|
||||||
been getting reports that newest runtimes don't have all dependencies to run
|
comes with all system packages needed to run Headless Chrome.
|
||||||
Chromium.
|
|
||||||
|
|
||||||
If you encounter problems due to missing Chromium dependencies, consider using
|
To use `puppeteer`, specify the module as a dependency in your `package.json`
|
||||||
Google Cloud Run instead where you can provide a custom Dockerfile with all
|
and then override the puppeteer cache directory by including a file named
|
||||||
dependencies. Also, see our
|
`.puppeteerrc.cjs` at the root of your application with the contents:
|
||||||
[official Docker image](https://github.com/puppeteer/puppeteer/pkgs/container/puppeteer).
|
|
||||||
|
```ts
|
||||||
|
const {join} = require('path');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {import("puppeteer").Configuration}
|
||||||
|
*/
|
||||||
|
module.exports = {
|
||||||
|
cacheDirectory: join(__dirname, 'node_modules', '.puppeteer_cache'),
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
|
> Google Cloud Functions caches your `node_modules` between builds. Specifying the
|
||||||
|
> puppeteer cache as subdirectory of `node_modules` mitigates an issue in which the
|
||||||
|
> puppeteer install process does not run when the cache is hit.
|
||||||
|
|
||||||
### Running Puppeteer on Google Cloud Run
|
### Running Puppeteer on Google Cloud Run
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user