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

Midway Serverless with puppeteer-core #750

Open
chantzekin opened this issue Dec 11, 2020 · 4 comments
Open

Midway Serverless with puppeteer-core #750

chantzekin opened this issue Dec 11, 2020 · 4 comments

Comments

@chantzekin
Copy link

想使用 Midway Serverless 实现阿里云 FC 的「Puppeteer 网页截图应用」模版,把代码迁移过来时候,本地和线上部署皆无法运行,报错如下

线上运行报错如下

{
   "errorMessage": "Failed to launch the browser process!\n/tmp/headless_shell: error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory\n\n\nTROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md\n",
   "errorType": "Error",
   "stackTrace": [
      "/tmp/headless_shell: error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory",
      "",
      "",
      "TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md",
      "",
      "at onClose (/code/node_modules/puppeteer-core/lib/cjs/puppeteer/node/BrowserRunner.js:193:20)",
      "at helper_js_1.helper.addEventListener (/code/node_modules/puppeteer-core/lib/cjs/puppeteer/node/BrowserRunner.js:183:68)",
      "at emit (events.js:194:15)",
      "at Interface.close (readline.js:379:8)",
      "at onend (readline.js:157:10)",
      "at emit (events.js:194:15)",
      "at endReadableNT (_stream_readable.js:1125:12)",
      "at _tickCallback (internal/process/next_tick.js:63:19)"
   ]
}

本地 macOS 环境报

UnhandledPromiseRejectionWarning: Error: Failed to launch the browser process!
/tmp/headless_shell: /tmp/headless_shell: cannot execute binary file

查看「Puppeteer 网页截图应用」模版内包含 headless_shell.tar.gz.fun/root/usr,已拷贝到目录,已配置

package:
  include:
    - headless_shell.tar.gz
    - .fun/*

但是执行 f deploy 时,并无拷贝 .fun/root/usr

想问问,这一块需要如何解决,有没有 Demo 可以参考一下?感谢。

@czy88840616
Copy link
Member

czy88840616 commented Dec 12, 2020

报错是因为fc环境似乎不兼容Puppeteer的库,事实上,所有的需要依赖glibc这些编译的场景都不太兼容。。暂时没有 demo 可用。

@czy88840616
Copy link
Member

@chantzekin 已联系阿里云镜像维护,增加 Puppeteer 默认依赖,估计上线要一阵子,上了之后通知你。

@chantzekin
Copy link
Author

@chantzekin 已联系阿里云镜像维护,增加 Puppeteer 默认依赖,估计上线要一阵子,上了之后通知你。

好咧辛苦,先去用 FC 模版摸索下啦

@xmsz
Copy link

xmsz commented Dec 17, 2020

之前踩坑了一下,阿里云开发需要自己指定puppeterr的lib目录就可以
FC的话用fun install自动处理依赖

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

No branches or pull requests

3 participants