Crawlee 在 GCP 上部署返回 BrowserLaunchError

问题描述 投票:0回答:1

我正在尝试部署一个非常基本的爬虫应用程序,由 Express 服务器提供服务。按照此示例 - https://crawlee.dev/docs/deployment/gcp-browsers,使用 PlaywrightCrawler,

persistStorage
为 false。

应用程序部署正确,但是当我调用爬网端点时,它在打印后立即返回错误

[33m PlaywrightCrawler:[39m Starting the crawler.

 "error": {
        "name": "BrowserLaunchError"
    }

这是我的app.yaml

runtime: nodejs20

instance_class: B4_1G

env_variables:
  API_PORT: 8080

basic_scaling:
  max_instances: 1
  idle_timeout: 5m

我没有经常使用GCP,所以这里可能缺少一些配置,但这里似乎没有足够的内存来运行爬虫。我真的不知道如何增加实例类之外的内存。

我正在使用谷歌云sdk来部署应用程序。关于如何让它运行有什么建议吗? App Engine(标准环境)不是这个平台吗?

谢谢

express google-cloud-platform google-app-engine playwright crawlee
1个回答
0
投票

根据您链接的文档,

Crawlee
需要无头浏览器。据我所知,您无法在 Google App Engine Standard 上安装“浏览器”(这就是您的
app.yaml
文件所暗示的内容)。 GAE 标准还有一个最大请求超时,范围为 1 - 10 分钟(请参阅ref),并且抓取通常需要更长的时间。

您的链接文档是指部署到

Google Cloud Run
(您可以在那里安装各种东西)。您还应该能够在
Google App Engine Flex
上运行 Crawlee,因为它让您可以自由地在 Dockerfile 中安装内容。

© www.soinside.com 2019 - 2024. All rights reserved.