Fonts no longer work inside functions with 11.37.0
See original GitHub issueDescribe the bug
I have a fairly high-trafficked function that generates png images from svgs using sharp in a Netlify function. The images include text and have been working fine until earlier today. I haven’t updated anything dependency-wise or related to the function at all, and suspect that something changed with the build system. And unfortunately, it isn’t something that can be fixed by rolling back because of this.
I’ve created a minimal example app to demonstrate the issue and deployed it to Netlify here: https://musing-ritchie-992016.netlify.app/.netlify/functions/svg
Which looks like this:

The text is rendered as boxes. There are no special fonts or anything referenced in the svg. The code for this can be found here: https://github.com/spencewood/svg-function . Running this locally from this repo using npm run dev and navigating to http://localhost:8888/.netlify/functions/svg I see what I expect:

While this doesn’t seem like a build or bundling issue, I do see in older deploy previews where this worked were @netlify/build <11.36.0 and this is a new issue as of @netlify/build 11.37.0. I have even found old deploy previews that worked and then redeployed them just to verify this, and on redeployment (no code changes) the issue appears. So simply going back to an older version of my code will still use the new @netlify/build, and I’m still stuck.
Configuration
I’m running everything through the Netlify UI on git hooks. Locally, I use node 14 with MacOS 11.4.
I’ve tried pinning @netlify/build to 11.36.0 in the package.json, but that didn’t work through Netlify CI. If there are other ways to do this, I would be delighted to know how. The affected site is very large and active, and I’d like to avoid CLI deploys unless absolutely necessary.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (3 by maintainers)

Top Related StackOverflow Question
Thank you so much @erezrokah ! I’ve got it all worked out now with the path update (no src). I guess my attempt at reproducing it simply without the font.config was actually a step backward. I really appreciate the time you took looking into this.
Thank you for reporting this! I’m sure it will help others.
I still want to figure out a way to do this without relying on the internal structure to make it “future proof”. I’ll comment here if/when I manage to do it.