小编bos*_*coe的帖子

如何让 puppeteer 在 Google Cloud Run/Cloud Build 中工作?

我有一个包含 puppeteer 网络爬虫的 docker 图像。当我构建和运行它时,它在我的本地机器上运行良好。它还在云构建中构建良好,部署到云运行并启动 http 服务器。但是,当我运行处理 puppeteer 实例的 cron 作业之一时,它超时并显示以下错误消息:

(node:13) UnhandledPromiseRejectionWarning: TimeoutError: Timed out after 30000 ms while trying to connect to Chrome! The only Chrome revision guaranteed to work is r706915
Run Code Online (Sandbox Code Playgroud)

完整日志:

A 2019-12-03T15:12:27.748625Z (node:13) UnhandledPromiseRejectionWarning: TimeoutError: Timed out after 30000 ms while trying to connect to Chrome! The only Chrome revision guaranteed to work is r706915 
A 2019-12-03T15:12:27.748692Z     at Timeout.onTimeout (/node_modules/puppeteer/lib/Launcher.js:359:14) 
A 2019-12-03T15:12:27.748705Z     at ontimeout (timers.js:436:11) 
A 2019-12-03T15:12:27.748716Z     at tryOnTimeout (timers.js:300:5) 
A 2019-12-03T15:12:27.748726Z     at listOnTimeout (timers.js:263:5) …
Run Code Online (Sandbox Code Playgroud)

node.js docker google-cloud-platform puppeteer google-cloud-run

6
推荐指数
2
解决办法
4517
查看次数