在 firebase 云函数中运行 puppeteer 代码 [英] running puppeteer code in firebase cloud functions
问题描述
我正在开发一个个人项目,这是一个用户可以输入地址和地址的应用程序.信用卡信息,然后单击按钮为我经常访问的一所大学购买停车许可证.
I'm working on a personal project which is an app where a user can input their address & credit card info and click a button to buy a parking permit for one of the universities that I visit often.
我想将我的前端托管在 firebase 的云存储中,并且我想创建一个云函数,其中 puppeteer 代码可以使用我保存到 firebase 实时数据库的信息运行.
I want to host my front end in firebase's cloud storage and I want to create a cloud function where puppeteer code can run with the information that I save to the firebase's realtime database.
firebase 云函数是否可以运行购买停车证的 puppeteer 代码?
Is it possible for a firebase cloud function to run the puppeteer code that buys a parking permit?
由于 puppeteer 不支持云功能,我可以使用 Heroku 来托管 puppeteer 代码吗?
Since puppeteer doesn't work with cloud functions, can I use Heroku to host the puppeteer code?
推荐答案
目前无法将 Puppeteer 与 Cloud Functions node 6 runtime 一起使用,因为运行已部署代码的服务器实例缺少共享Puppeteer 所需的库.您可以在 此 GitHub 问题 中了解相关内容.另请参阅此问题.
It's currently not possible to use Puppeteer with the Cloud Functions node 6 runtime because the server instances that run deployed code are lacking a shared library that's required by Puppeteer. You can read about that in this GitHub issue. Also see this issue.
从 node 8 运行时 版本开始,提供 puppeteer 所需的库.
As of the node 8 runtime release, the required libraries for puppeteer are available.
这篇关于在 firebase 云函数中运行 puppeteer 代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!