Not able to access large media during build

Hi folks

I’m using Large Media on my project and during the build process I need to be able to access the images managed by Large Media so I can generate some meta data needed for the build. This works fine locally by during the Netlify build I get

gridsome.server.js: unsupported file type: undefined (file: /opt/build/repo/static/images/uploads/erin-doering-drjh_8g5xq8-unsplash.jpg) (21:26)

To be honest I don’t fully understand how the magic behind Large Media\Git LFS works so not sure why these files are available on disk locally but not during the build - is there a Large Media API I need to use instead in order to get access to the images?

Thanks ahead

@kitsune, you have found one of the limitations of Netlify Large Media (NLM). It doesn’t support using the assets during the build process.

Our documentation covers this here, quoting:

Files tracked with Large Media are uploaded directly to the Netlify Large Media storage service on push, completely bypassing the site build. This saves build time, but also means that the files are not available to tools that process asset files during the build, such as Hugo’s image processing or the gatsby-image plugin. Depending on your needs, you may be able to replace this functionality with Netlify’s image transformation service.

Simply put, if you are using Large Media the media files tracked in Large Media are not available during the build itself.

If this access during build is required, you won’t be able to use NLM for this site.

You can still use other Git LFS services though and get actual file during the build. If you do another Git LFS service, please include the following environment variable (either in the Netlify UI for the site build settings on in the netlify.toml file for the site):

GIT_LFS_ENABLED=true

This means Netlify will download the actual binary file during the build instead of the pointer. Again, though, this setting works with other Git LFS services but not with NLM.

1 Like