Skip to content

Missing fonts in lambda layer #9

Open

Description

@eranmit99

Hi,
I am using the prebuilt layer that was provided.
After exporting the canvas on the lambda all text is shown with squares, locally it works fine.
Seems like the lambda OS is missing fonts. did anyone encounter this ?

code example:

ctx.font = '30px Impact'; ctx.rotate(.1); ctx.fillText("Awesome!", 50, 100); canvas.toDataURL();

output:

Activity

  1. jwerre commented on Feb 10, 2020

    @jwerre
    Owner

    @eranmit99 I added a couple more libraries to the layer (libfontconfig.so.1, libpixman-1.so.0). Can you pull the latest and try again?

  2. eranmit99 commented on Feb 10, 2020

    @eranmit99
    Author

    Did u put it in node 10 layer - I don't see any changes ..

  3. jwerre commented on Feb 10, 2020

    @jwerre
    Owner

    Hmm. Sorry, I don't have time to look into this now but you try compiling it yourself? Just fire up Docker and follow the instructions at the end of the README. Let me know how it goes.

  4. eranmit99 commented on Feb 11, 2020

    @eranmit99
    Author

    OK tnx

  5. alexlitel commented on Feb 14, 2020

    @alexlitel
    Contributor

    @eranmit99 I would guess the remote deployment doesn't have any fonts or fontconfig loaded. I just ran into this problem and fixed it by calling packaging a font file in my deployment and calling registerFont from canvas with the path of the font like this (replace path and name with your own):

    registerFont('./static/fonts/Roboto.ttf', { family: 'Roboto' })

    Can't seem to suppress #2 (or use that config to load the font file instead of calling registerFont, but it doesn't throw an error so it's not a huge deal.

    @jwerre Will running the updated dockerfile and manually compiling / deploying to lambda layer on its own fix the errors with lambda not having a fontconfig?

  6. marked Missing fontconfig file #16 as a duplicate of this issue on Feb 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions