
I've checked the openruntimes executor logs, appwrite worker function logs, and the appwrite logs but none give anything more detailed.

how'd you install chromium here?

I just installed it with node

It checks to see if it’s installed and if it isn’t it installs it.

have you see this error?
qemu-x86_64: Could not open '/lib64/ld-linux-x86-64.so.2': No such file or directory

I’ve not seen that with the way I’m currently installing chrome now. Seems to work pretty reliably. Though the first execution after deploying or after it’s gone to sleep takes about 20 seconds because it has to install chrome.

so you were able to get it working?


Yes, not the way I’d like. I’d like to be able to get it installed in the build step but it just doesn’t seem possible for me to do.

ya...do you know if it's the download that's slow or the install?

ok...so i manged to download the apks during build...but they still need to be installed later

I can download the chromium files with apk add chromium but no matter what I do I can’t get them to move to the build folder. I have more luck locally where I can get it there but puppeteer and playwright cannot launch chrome successfully. On cloud I can’t even copy them over it just times out at around 50 seconds

I don’t think you can use the install command that comes with either playwright or puppeteer to install chrome. I think you have to use apk add

add this as an env var:
PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser
your build/install command will be:
apk update && apk fetch chromium nss freetype harfbuzz ca-certificates ttf-freefont && npm i
instead of just npm i
Then, you can do the same thing as you were doing, but use the downloaded apks:
import { execSync } from 'node:child_process';
import puppeteer from 'puppeteer';
let installed = false
export default async (context) => {
try {
if (installed) {
context.log('already installed chromium');
} else {
execSync('apk add /usr/local/server/src/function/*.apk');
context.log('installed chromium');
installed = true;
}
const browser = await puppeteer.launch({
headless: true,
args: [
"--no-sandbox",
"--headless",
"--disable-gpu",
"--disable-dev-shm-usage",
],
});
return context.res.send("loaded puppeteer");
} catch (e) {
return context.res.send(e.message);
}
};

maybe this will speed things up for you

Awesome! I’ll check it out tomorrow and let you know.

So installing on the build container will go over to the function running container? The biggest issue I had at the beginning is that they wouldn’t transfer over

cold start of 10s

Cool beans! Thanks for looking into it

When trying to deploy this to cloud I get this
"commands": "apk update && apk fetch chromium nss freetype harfbuzz ca-certificates ttf-freefont && npm i && npm run build",

Nevermind, I added --no-scripts with npm install and it works now.

So does this mean it will have to install chrome from the node function for every cold start?

I had setup a route for keeping the function warm, do you think that's alright to do or is there abverse effects to never letting the function sleep

yes, it still needs to install chrome, but it should be faster since it doesn't need to download the packages.

ya that's fine
Recommended threads
- Every time I deploy a function via CLI, ...
deploying appwrite function via cli breaks Git connection in function settings tab but when I push to git triggered deployment fail. usually multiple deployment...
- A way to configure cloud function config...
Is there a way to configure cloud functions locally and keep that in github and deploy from source control instead of manually configuring it from the console f...
- Cannot create a user
Hi, I am using a lowcoder frontend and trying to create a user in Appwrite (python function). Unfortunately, all I got is an error: "Raw body: Error". It means...
