Images returning 404 and .lsfconfig is missing

I have a site at https://riverabove.netlify.app/ and it is using netlify large media. I had some problems with the install process causing fatal errors in my .gitconfig file but have fixed them. The three images in my repo are appearing on the large media screen in the netlify, so they seem to have been deployed. However, at the URL I expect them they do not appear. For example, images/cdpn/falls-small.jpg returns a 404.

Am I looking in the wrong place for my images, or is there a configuration issue? netlify lm:info appears to be okay:

$ netlify lm:info
√ Checking Git version [2.24.0.windows.2]
√ Checking Git LFS version [2.9.0]
√ Checking Git LFS filters
√ Checking Netlify’s Git Credentials version [0.1.10]

However .lsfconfig does not exist in my repo, possibly due to the issues I had installing netlify large media.

@Vaughan_Curd Welcome to the Netlify community.

Can you provide a page on which a non-functioning image link appears?

@gregraven https://riverabove.netlify.app/principles/

@Vaughan_Curd Excellent, thanks.

When you download your deploy via the Netlify dashboard for this site, is this image at that pathway?

@gregraven There are files at that path but they are all 1KB files, so not the actual files in my repo. The are text based files referencing SHA hashes and some git info.

@gregraven So it appears the git lfs pointers are present at the image URLs. Is there a configuration issue preventing them from being replaced with the actual image files?

Sorry, I don’t know the answer to this one. Someone else will have to jump in.

@gregraven Thanks for your help.

Hi, @Vaughan_Curd. I do see this site using the Large Media add-on. In most cases, the issue is happening because those Git LFS files were uploaded to the original Git host (GitHub) but haven’t been sent to Large Media (which is the new Git LFS service now that the .lfsconfig file has been added to the repo).

This is only a best guess but if that is happening, you can upload the files to the Git LFS service with this:

git lfs push --all

and that should resolve the issue.

We have a support guide with more detail about this here:

It is possible something else is happening so if that doesn’t fix it, please let us know.

@luke I don’t have a .lfsconfig file in my repo. I had errors with installing the netlify large media add-on and the .lfsconfig file was not created.

Hi, @Vaughan_Curd. Then there are two possible solutions:

  1. We can uninstall the Large Media add-on and you can use the Git LFS service provided by GitHub.
  2. You can add the .lfsconfig file needed and use Large Media for the Git LFS service.

Solution 1

For option one, please read this support guide and then let us know when you are ready to proceed.

Once Large Media is uninstalled, the final two steps are:

  • add the required environment variable GIT_LFS_ENABLED=1 to the site settings here (which must be done in the Netlify web UI only - netlify.toml won’t work for this as the value is needed before cloning and we only have the current netlify.toml after cloning)
  • trigger a new build of the site

Solution 2

For option two, the first step is to create the missing .lfsconfig file. Just create a file with that name (no extension) in the base directory of the repo and add the following to it:

[lfs]
	url = https://<SITE API ID HERE>.netlify.app/.netlify/large-media

You can get the site’s API ID on this page:

https://app.netlify.com/sites/riverabove/settings/general#site-information

For example, if the API ID was “3d25f98b-c822-4ba8-ae5d-efaeb6052c90” (and it isn’t - but if it was), then the file .lfsconfig would contain this:

[lfs]
	url = https://3d25f98b-c822-4ba8-ae5d-efaeb6052c90.netlify.app/.netlify/large-media

That file then needs to be committed to the repo and pushed upstream.

Once this change is made, this will make Netlify’s Large Media service the Git LFS service for this repo. Remember, once this is done, the git lfs push --all command can be used to sync the files in the local repo to Netlify’s Git LFS service (which is called “Large Media”). This will allow the images to be displayed when you browse the site.

​Please let us know if there are questions about either solution or if you are ready for us to proceed with the Large Media uninstall.

3 Likes

@luke Thanks very much, option 2 worked great for me.