api-screenshot
api-screenshot copied to clipboard
Enable puppeteer and Chromium to work with latest versions of Node.
Update puppeteer-core and replace chrome-aws-lambda with @sparticuz/chromium
The current code will only work with Node 12, meaning it can't be deployed out of the box as Netlify uses Node 16.
The chrome-aws-lambda
package hasn't been maintained in over a year, https://github.com/sparticuz/chromium is an alternative that provides the same functionality.
This is now able to be auto-deployed by Netlify and run out-of-the-box again
Sources:
- https://answers.netlify.com/t/netlify-cli-dropping-support-for-node-js-version-12/75130
Deploy Preview for eleventy-api-screenshot failed.
Name | Link |
---|---|
Latest commit | 804ed9359288a840e2a01efd258f0f4111b31f74 |
Latest deploy log | https://app.netlify.com/sites/eleventy-api-screenshot/deploys/6364ebbfe9e4db00088a0859 |
Ah okay, looks like the Chromium package includes the Chromium binary and means the bundle is 60mb. Interestingly, it deploys without issue for me - could be because my deploy is using Ubuntu Focal, whereas yours is using Xenial
Trying the changes in this test on Netlify and it just times out on each request.
Thank you @LewisDaleUK! I ended up using these code changes in the v1-vercel
branch and api-screenshot
which is the primary branch moving forward. Happy to merge them to v1-netlify
too now.