Moderator
I've checked the openruntimes executor logs, appwrite worker function logs, and the appwrite logs but none give anything more detailed.
Votes
0
Replies
24
Participants
Unknown
Messages
25
Moderator
I've checked the openruntimes executor logs, appwrite worker function logs, and the appwrite logs but none give anything more detailed.
Admin
how'd you install chromium here?
Moderator
I just installed it with node
Moderator
It checks to see if it’s installed and if it isn’t it installs it.
Admin
have you see this error?
qemu-x86_64: Could not open '/lib64/ld-linux-x86-64.so.2': No such file or directory
Moderator
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.
Admin
so you were able to get it working?
Moderator
Moderator
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.
Admin
ya...do you know if it's the download that's slow or the install?
Admin
ok...so i manged to download the apks during build...but they still need to be installed later
Moderator
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
Moderator
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
Admin
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); }};Admin
maybe this will speed things up for you
Moderator
Awesome! I’ll check it out tomorrow and let you know.
Moderator
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
Admin
cold start of 10s
Moderator
Cool beans! Thanks for looking into it
Moderator
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",
Moderator
Nevermind, I added --no-scripts with npm install and it works now.
Moderator
So does this mean it will have to install chrome from the node function for every cold start?
Moderator
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
Admin
yes, it still needs to install chrome, but it should be faster since it doesn't need to download the packages.
Admin
ya that's fine