question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Fonts no longer work inside functions with 11.37.0

See original GitHub issue

Describe 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:

Screen Shot 2021-06-09 at 8 57 19 PM

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:

Screen Shot 2021-06-09 at 8 58 09 PM

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:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
spencewoodcommented, Jun 10, 2021

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.

0reactions
erezrokahcommented, Jun 10, 2021

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

PostScript Type 1 fonts end of support - Adobe Support
Type 1 fonts will not appear in the Photoshop Fonts menu; Previously installed Type 1 fonts will no longer work in Photoshop; Opening...
Read more >
RemoveFontResourceW function (wingdi.h) - Win32 apps
The RemoveFontResource function removes the fonts in the specified file from the system font table. (Unicode)
Read more >
WordPress - Google Fonts not working in .php file
function wpb_add_google_fonts() { wp_enqueue_style( 'wpb-google-fonts', 'https://fonts.googleapis.com/css2?family=Poppins:wght@100;300;400;500; ...
Read more >
Function _WinAPI_EnumFontFamilies - AutoIt
[optional] The pattern string to include (exclude) the fonts in (from) the enumerating. This makes sense only if the typeface name is not...
Read more >
clamp() - CSS: Cascading Style Sheets - MDN Web Docs
The clamp() CSS function clamps a middle value within a range of values ... Note that using clamp() for font sizes, as in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found