Font not found in opengraph image generation

Hello,

We need to generate open graph images for a project I’m working on. The image uses custom fonts. Locally the image generates perfectly fine, however, when I deploy the project the image throws the following error:

 Error: ENOENT: no such file or directory, open '/var/task/public/fonts/Montserrat-Bold.ttf' at async open (node:internal/fs/promises:639:25) at async

Using the following code snippet:

await readFile(join(process.cwd(), 'public/fonts/Montserrat-Bold.ttf'))

When I load another font it does work. The font does exist in the public folder:


But when I list all files in the fonts folder during execution it only shows 1 font:
image
So it looks like not everything is accessible within the serverless function.

Does anyone know how to fix this?
I’m using Next JS V14.2.20

Thanks!