-
-
Notifications
You must be signed in to change notification settings - Fork 295
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
Incorrectly formed path to /bin/chromium.br' #270
Comments
I had a similar issue with my function on Netlify where I needed to make sure netlify.toml [functions.render]
external_node_modules = ["chrome-aws-lambda"] Perhaps you need one of the Lambda layers to make sure the module is loaded as well? |
- addressing libsso missing issue with v16 alixaxel/chrome-aws-lambda#264 - Addressing the issue with chrome.br missing alixaxel/chrome-aws-lambda#270
Any solution to this yet? |
Yes, you have use lambda layers |
@Facundojs , can I get a repo example of how you used these modules in the lambda handler itself after separating the layers |
Assuming you included lambda layers as we talked, you should use a code as below, you can launch browser. import * as playwright from 'playwright-core';
import chromium from 'chrome-aws-lambda';
export const createBrowserContext: () => Promise<playwright.BrowserContext> =
async () => {
const browser = await playwright.chromium.launch({
headless: chromium.headless || true,
executablePath:
(await chromium.executablePath) || '/bin/google-chrome-stable',
args: chromium.args,
});
return await browser.newContext({
userAgent:
'Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.4 Mobile/15E148 Safari/604.1',
viewport: { width: 808, height: 364 },
screen: { width: 414, height: 896 },
acceptDownloads: true,
deviceScaleFactor: 3,
isMobile: true,
hasTouch: true,
});
}; You shoul use this function for every lambda. # Basic
ValidateCredentials:
handler: src/scrapper/validate-credentials/index.handler
layers:
- arn:aws:lambda:us-east-1:{id}:layer:crypto:1
- arn:aws:lambda:us-east-1:{id}:layer:ws-layer:2 # This layer include chromium
- arn:aws:lambda:us-east-1:{id}:layer:playwright:1 # This layer include playwright-core |
Thank you a lot so far for your help.
I have been able to build/deploy and attach the bundle layer. Now I’m faced with this error when I invoke my lambda cloud version

Have you encountered such issue?
… On 16 Aug 2023, at 02:40, Facundo Julián Serrano ***@***.***> wrote:
Assuming you included lambda layers as we talked, you should use a code as below, you can launch browser.
In local await chromium.executablePath will return null, thats why i use || {my-local-path}
import * as playwright from 'playwright-core';
import chromium from 'chrome-aws-lambda';
export const createBrowserContext: () => Promise<playwright.BrowserContext> =
async () => {
const browser = await playwright.chromium.launch({
headless: chromium.headless || true,
executablePath:
(await chromium.executablePath) || '/bin/google-chrome-stable',
args: chromium.args,
});
return await browser.newContext({
userAgent:
'Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.4 Mobile/15E148 Safari/604.1',
viewport: { width: 808, height: 364 },
screen: { width: 414, height: 896 },
acceptDownloads: true,
deviceScaleFactor: 3,
isMobile: true,
hasTouch: true,
});
};
You shoul use this function for every lambda.
Below, i show you an example about the aws-lambda declaration
# Basic
ValidateCredentials:
handler: src/scrapper/validate-credentials/index.handler
layers:
- arn:aws:lambda:us-east-1:{id}:layer:crypto:1
- arn:aws:lambda:us-east-1:{id}:layer:ws-layer:2 # This layer include chromium
- arn:aws:lambda:us-east-1:{id}:layer:playwright:1 # This layer include playwright-core
—
Reply to this email directly, view it on GitHub <#270 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/ANVQDIDFHV3W3FHIUFAA3CDXVQQKTANCNFSM5S5BHY2A>.
You are receiving this because you commented.
|
Here is the generatePDF function and the template for the lambda


… On 16 Aug 2023, at 02:40, Facundo Julián Serrano ***@***.***> wrote:
executablePath:
(await chromium.executablePath) || '/bin/google-chrome-stable',
|
I cant se correctly the file. Looks like a github problem |
I found a solution, but the issue now is how to reference the modules
inside the helper method utilized by the generate download handler
…On Thu, 17 Aug 2023 at 13:03, Facundo Julián Serrano < ***@***.***> wrote:
I cant se correctly the file. Looks like a github problem
Try copi/paste
—
Reply to this email directly, view it on GitHub
<#270 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ANVQDIHDGCQPJ56RVTF3C73XVYCBZANCNFSM5S5BHY2A>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Im using
chrome-aws-lambda
andplaywright-core
just like the example. At the moment of usage of it in a serverless functions, i get the error"Error: ENOENT: no such file or directory, open '/var/task/src/scrapper/f_service/bin/chromium.br'\"
.Also, i tried to add it in a layer wiht both libraries but still is failing.
This is my code:
This is how my dir looks like
My system
AWSLambda os is the default
The text was updated successfully, but these errors were encountered: