-
-
Notifications
You must be signed in to change notification settings - Fork 296
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
[BUG] Error on AWS, cannot find chromium.br file #67
Comments
well I just deploy it with import chromium from 'chrome-aws-lambda';
import puppeteer from 'puppeteer-core';
export default async function print({
url
}) {
let browser = await puppeteer.launch({
args: chromium.args,
defaultViewport: chromium.defaultViewport,
executablePath: await chromium.executablePath,
headless: chromium.headless,
});
const page = await browser.newPage();
await page.goto(url, {
waitUntil: ['networkidle0', 'load', 'domcontentloaded'],
});
const result = await page.pdf({
printBackground: true,
format: 'A4',
displayHeaderFooter: false,
});
return result.data;
} Here is a portion of my serverless.yml file: service: sling-lambda-print-2
provider:
name: aws
runtime: nodejs10.x
stage: dev
region: us-east-1
environment:
DEBUG: false
LOGGING: true
iamRoleStatements:
- Effect: Allow
Action:
- s3:*
Resource: "arn:aws:s3:::${self:custom.bucket}/*"
- Effect: Allow
Action:
- s3:ListBucket
Resource: "arn:aws:s3:::${self:custom.bucket}"
- Effect: Allow
Action:
- lambda:InvokeFunction
- lambda:InvokeAsync
Resource: "*"
plugins:
- serverless-webpack
custom:
chrome:
flags:
- --hide-scrollbars
functions:
- render
bucket: headless-print-files
functions:
render:
description: Render pdf
memorySize: 2536
timeout: 300 # AWS Lambda limitation
handler: src/handlers/render.default
environment:
DEBUG: false
BUCKET: ${self:custom.bucket}
FONTCONFIG_PATH: /var/task/fonts
resources:
Resources:
ApiGatewayRestApi:
Properties:
BinaryMediaTypes:
- "*/*"
|
@kamilkp I can't provide support for serverless, you should open a issue with them, I suspect that Also not sure where this configuration is original from, but I don't think you should be setting |
In case someone finds this issue in the future here's what I did to solve it:
externals: ['aws-sdk', 'chrome-aws-lambda'],
funcitons:
your_function:
layers:
- arn:aws:lambda:<region>:<id>:layer:<name of layer>:<revision> |
@alixaxel might be worth adding this to your readme maybe? ^ |
I am following this instruction with the framework version 1.78.1 and serverless-webpack@latest When I overide my externals variables in webpack.config.js as shown above, I get following error on deploy
So I keep externals as
This makes sure the chrome-aws-lambda module is not bundle... however when i deploy and run the code I get |
@kamilkp Could you please share the contents of the .zip file you loaded to the chrome-aws-lambda layer? im not sure what contents to load to the layer |
how do I configure |
What can be done when not using web pack for externals? |
Trying to get a basic example to work on AWS lambda and here's the error I get: Seems like chromium is not installed on the OS there?
Environment
chrome-aws-lambda
Version: 1.20.3puppeteer
/puppeteer-core
Version: 1.20.0Expected Behavior
Should work
Current Behavior
Error: ENOENT: no such file or directory, open 'node_modules/chrome-aws-lambda/source/../bin/chromium.br'
Possible Solution
Steps to Reproduce
The text was updated successfully, but these errors were encountered: