Back

Appwrite Functions: Library not found

  • 0
  • Functions
  • Cloud
outroddet_
6 Jan, 2025, 22:05

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:

TypeScript
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 πŸ˜„

TL;DR
Developers are having an issue with Appwrite Functions not finding a library when trying to execute a function. The error message indicates that the library 'libgobject-2.0-0' cannot be loaded. The problem seems to arise from the differences in directories when installing libraries like weasyprint. To resolve this, adjust the installation process to ensure the correct directory is used. Regarding the return type of the main function, the code snippet provided appears to be correct. However, documentation for the '.binary' function was not found.
Kenny
6 Jan, 2025, 22:09

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.

Kenny
6 Jan, 2025, 22:09

I had a similar issue with trying to install chrome, but I don't remember exacty what directory is the right one. Sorry /:

outroddet_
6 Jan, 2025, 22:13

So you installed chrome in a different dir?

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more