Build-image: LFS support for font files

Created on 28 May 2018  路  17Comments  路  Source: netlify/build-image

Hello,

I've been pushing updates on my github repository and have seen that the only not-google font was not displayed by the browser.
In Chrome, I had the error Failed to decode downloaded font

Here was the content of downloaded font (https://monsieur.tech/fonts/Archive.ttf.woff)

version https://git-lfs.github.com/spec/v1
oid sha256:4cb3bb4abca55976ab304152686f7c22cb19511078cb1bb3f6394c1fb59d36dc
size 17552

So I've used netlifyctl to deploy and now, the font is correctly displayed.

After a quick look around the issue seems to be in buildbot-git-config with

[lfs]
    fetchinclude = *.jpg,*.png,*.svg,*.gif,*.pdf,*.mp4

It will be good if you can also add *.eot,*.woff.

Thx
Baptiste

Most helpful comment

@arthurlogilab no, I don't think. I should remove them from my netlify.toml to avoid another mix up...

All 17 comments

@daiyam I just filed an issue internally to allow specifying the include filter via the netlify.toml config file. Would this fix the issue for you?

@brycekahle Yes, I think so. It's even a better solution. Thx

Hi @brycekahle , I'm interested in this subject, can you clarify how can I specify this new option you implemented in my netlify.toml ?
Thanks for your time

@daniele-pelagatti It hasn't been implemented yet. I will update this ticket when it is available.

@daiyam @daniele-pelagatti you can now specify the fetchinclude filter with the environment variable GIT_LFS_FETCH_INCLUDE.

@brycekahle I have setup the build environment variable GIT_LFS_FETCH_INCLUDE with the value *.eot,*.gif,*.jpg,*.pdf,*.png,*.svg,*.woff and I'm still getting the error...
(maybe the fix hasn't been committed?)

@daiyam make sure you also specify GIT_LFS_ENABLED=true

@brycekahle yes, I was missing GIT_LFS_ENABLED=true. Now, I can see in the log using git lfs fetchinclude override of: *.eot,*.gif,*.jpg,*.pdf,*.png,*.svg,*.woff. But I'm still getting the error :cry:

@daiyam You might want to contact support. They can help debug your build.

@brycekahle Is this on the netlify docs at all? I only see the boolean env var, not the one for fetch include. In fact I get a single result from google if I query that env var with netlify as a 2nd keyword.

Am getting a build failure with GIT_LFS_ENABLED=true https://gitlab.com/arthurlogilab/www.logilab.fr/merge_requests/20

The diff for the netlify.toml is here : https://gitlab.com/arthurlogilab/www.logilab.fr/merge_requests/20/diffs?commit_id=dab0283148e51ef630b2b5b8ffc2ee1f15fa136b

I'm getting

10:42:48 AM: git clone [email protected]:arthurlogilab/www.logilab.fr
10:42:49 AM: Preparing Git Reference merge-requests/20/head
10:42:50 AM: Error checking out branch: Downloading images/118k.png (9.4 KB)
Error downloading object: images/118k.png (4ee8d48): Smudge error: Error downloading images/118k.png (4ee8d484ca629a47c29f87ff7057daf624aa99f7853ad38299465781702adf2d): batch request: missing protocol: ""

Errors logged to /opt/build/repo/.git/lfs/logs/20190226T094250.925550906.log
Use `git lfs logs last` to view the log.
error: external filter 'git-lfs filter-process' failed
fatal: images/118k.png: smudge filter lfs failed
10:42:50 AM: Failing build: Failed to prepare repo
10:42:50 AM: failed during stage 'preparing repo': exit status 128
10:42:51 AM: Finished processing build request in 4.042875978s
10:42:51 AM: Shutting down logging, 0 messages pending

talks about lfs, but doesn't seem to run git lfs clone instead of git clone

@arthurlogilab can you try with GIT_LFS_ENABLED = "true" or by adding a GIT_LFS_FETCH_INCLUDE like GIT_LFS_FETCH_INCLUDE = "*.eot,*.gif,*.jpg,*.pdf,*.png,*.svg,*.woff"?

@daiyam Thanks for your answer. Tried both options, not better. Would it be a "sections" problem ?

@arthurlogilab sorry, I forgot those variables have to be put in their UI under Deploys / Continuous Deployment / Build environment variables...

@daiyam ok, that fixed it. So the variables can't be used in the netlify.toml ?

@arthurlogilab no, I don't think. I should remove them from my netlify.toml to avoid another mix up...

This issue was a godsend for me. I've been tearing my hair out trying to get fonts to load from LFS correctly in Netlify. I documented it all in this community support thread which could be useful for those running into this in the future.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

KyleAMathews picture KyleAMathews  路  5Comments

jlengstorf picture jlengstorf  路  4Comments

edmorley picture edmorley  路  6Comments

vbrown608 picture vbrown608  路  6Comments

rjvdw picture rjvdw  路  3Comments