Webm not working under Git(hub) LFS

Similar to this post about webp not working under LFS, I’m currently experiencing the same exact issue but with webm files – looking at the rendered HTML (it’s a Gatsby site), it looks like the video has been inlined, with a content-length of 129 bytes – likely the pointer from LFS (we’re using Github.)

Once we removed webm from the .gitattributes, the video loaded as intended. Works locally too.

Does anyone else have this issue? Unfortunately I can’t post a link here, but happy to DM a branch link to support staff. In case it matters: the site is password protected. Thank you!

An example of the issue in action: a <video> tag with a webm source –

image

Note the mp4 is fine. I’ve now experienced this same issue on two different sites. My solution thus far has been to just remove the webms from LFS but of course that is not optimal or possible with some larger files.

Hi, @mfan, I believe I’ve already replied to a parallel inquiry via another channel but I want to share the same information publicly here for anyone else running into this issue.

There are two environment variables which control if and which files get the actual binary file contents downloaded instead of the Git LFS pointers (which is the default for a git clone).

The first is GIT_LFS_ENABLED=true. This determines if the git clone at Netlify will even attempt to download the actual files instead of their text pointers.

However, the second environment variable is not well documented (yet as I have a created feature request to update our public documentation to include this). This second environment variable is the GIT_LFS_FETCH_INCLUDE environment variable.

The current defaults for this are:

GIT_LFS_FETCH_INCLUDE=*.jpg,*.png,*.jpeg,*.svg,*.gif,*.pdf,*.mp4,*.bmp

This can really only be found here (for now as I’ve opened an issue to get our public docs updated to include this):

To override these defaults (and download the Webm files in addition to the MP4s), please create a new environment variable which includes all types of file you want to download. For example, you can just add *.webm to the current list with this environment variable:

GIT_LFS_FETCH_INCLUDE=*.jpg,*.png,*.jpeg,*.svg,*.gif,*.pdf,*.mp4,*.bmp,*webm

I’m not 100% but I do suspect the filtering is case-sensitive based on this:

So, please do include all required case variations.

To summarize, the solution for this will be to include both environment variables at Netlify for this site. Note, these environment variables must be defined in the Netlify web UI for the site. If you defined them in netlify.toml they are in the repo and won’t be used during the git clone because we need to clone the repo in order to see the environment variables. This is why they must be defined in the UI.

If there are other questions about this, please let us know.

1 Like

Can confirm. Added GIT_LFS_FETCH_INCLUDE to include webm, triggered a rebuild, and voila. All is working.

Thank you @luke for this prompt and thorough explaination!!

Glad to hear this resolve the issue, @mfan! :smiley:

If/when we get our docs updated, we will post an update here to let the community know about it.

Our docs could be clearer and document this better. We’re working on doing just that. :+1:

1 Like