I am trying to get a headless chrome browser to work with gatsby and failing so far. Even with the Netlify-Labs Repo netlify-labs/netlify-functions-headless-chrome, I was unable to understand what is going on here.
create package json in function folder.
change permissions of folder
create zip of folder
move folder
update toml file to direct to folder
What is supposed to happen to this zip, what reads it?
can netlify-lambda be used to take care of this zip?
Can someone help me understand this process and what I do not understand?
David,
I appreciate the response. I did mention this in my post as you later commented, but I am not having a problem building, it is actually zipping and completing without error. So I have no idea how to debug or what is going on. If we need to bump up the level and start paying, that will inevitably happen later when my client is ready to go public. As for now, there is no errors on build.
Is there a way to tell your function if you are using netlify dev to build it locally so you can use your local version of chrome instead of puppeteer-core? I’m having issues testing locally.
@itwasmattgregg did you install the local node_modules? npm will look there before it goes to your globally installed modules. Can you provide more context for the problem you’re having? If you’re using headless chrome installed locally then it should be used in your function when you import/require it.
So I’ve got a function running puppeteer. It imports puppeteer-core and chrome-aws-lambda in the function and runs them there. However when I try to call the function locally I get this error:
error Error: Chromium revision is not downloaded. Run "npm install" or "yarn install"
at Launcher.launch
Did some digging on that and it seems there is an issue with running puppeteer-core on a machine that has Chrome installed globally. I guess it gets confused.
I found that on the free plan it’s not really possible to download and run chromium (even the chrome-aws-lambda version). I found another way of doing what I wanted.
Still never solved the issue though of Chromium revision not being found when running locally.
Hi there, may I ask how you know this information for sure? Is it mentioned in the docs? I use Puppeteer in my Netlify project and it failed to open Chromium too. What is that other way you tried, could you please share it with me? Or does upgrading to paid plan/subscription really solve the problem? Thank youu
No reproduction steps were given so I don’t know what the issue was.
From what is said there it sounds like it wasn’t a problem at Netlify. It sounds to me that it was an issue with the local system.
Also, upgrading from Starter to Pro doesn’t change anything about how Functions work at Netlify. Changing plan types cannot be the solution for this reason.
To summarize, it was never explained what the issue actually was or how it was resolved.