I was trying to make a python function for renderering a pdf with weasyprint. Because appwrite uses alpine images I added following lines to the build settings:
apk add --no-cache weasyprint
pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt
In a local docker env everything works well, but appwrite does not find the library when trying to execute the function: OSError: cannot load library 'libgobject-2.0-0': Error loading shared library libgobject-2.0-0: No such file or directory. Additionally, ctypes.util.find_library() did not manage to locate a library called 'libgobject-2.0-0'
Additionally, I wanted to ask if this: return context.res.binary(io.BytesIO(rendered_pdf), 200, { "Content-Type": "application/pdf" }) would be the right return type of the main function? Because I didn't find any docs of the .binary function. Thanks 😄
I think this because the directory that apk add installs to is not the directory that is cloned into the vm that spins up for the function.
I had a similar issue with trying to install chrome, but I don't remember exacty what directory is the right one. Sorry /:
So you installed chrome in a different dir?
Somebody got an idea of what to do??
Yea... if I remember correctly there is a directory that gets copied to the vm that spins up for the function, but I don't remember the directory and I don't have access to my self hosted instance rn to check.
Though that was a long time ago and functions have been through various revisions since then
Someone else might have better insight, but here was the issue I was having while trying to frontload chromium.
https://discord.com/channels/564160730845151244/1152721465356066897/1157120187384991874
I ended up having to install it each time the function cold starts. They could be non-related at all, but that's the issue I was getting when trying to install something using the apline package manager.
Recommended threads
- How to access oldValue payload in functi...
I want to record old and new values of data changes as audits. But when i try to read row in function. The value is new already even before grt updated
- Database table mysteriously empty this m...
Hello, I'm testing out appwrite (free) with a simple vue app. This morning a I created a few indexes on a table, and then noticed that it was empty... I don't e...
- Issue: Getting 401 Unauthorized Error Wh...
Hi team, I'm encountering a 401 user_unauthorized error when trying to create a row in my projects table, even though I have full user permissions configured fo...