Support Forums

Missing files when deployed to Netlify

URL: Shortkurt
GitHub: pexeixv/shortkurt

When I run the site locally using netlify dev, it works fine, however, when deployed to Netlify, certain assets are missing. If I go to shortkurt.netlify.app/.netlify/functions/get-classes it redirects me to 404 page, indicating that the serverless function is missing too.

While looking for a solution, I came across this article which said that this problem could be due to using camelcase convention for file names. So I refactored the function getClasses.js to get-classes.js. Sadly, that didn’t solve the issue. All my other files are single-named files so they’re all in lowercase only. I can’t get a hang of what the issue is.

Also, I think it’s worth mentioning this: In the get-classes.js file, I am using XMLHttpResponse to make the GET request. Its documentation says that it is to be imported like so: var XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest. I am aware this is camelcase, but I can’t really change it because that is how it’s supposed to be imported.

Hoping to get a response from the lovely community over at Netlify. Thank you in anticipation!

Hey @pexeixv,

Must say I’ve not use the XMLHttpRequest method. As per Netlify Function I’ve always used fetch like this example.

Looking at your function I think changing this to a fetch request should take little effort.

I don’t think it matters if you use XMLHTTPRequest of Fetch. They basically do the same thing in most cases. But still, worth a try.

However, if I directly visit the function URL @pexeixv shared, I don’t get 404:

that the function is working (not redirecting to 404 like you mentioned). Could you explain what exactly is not working?

The issue is that some files are missing after the build. Like for example, I have a file sun.svg . It’s there in the Github repo, but goes missing after Netlify deploys it. shortkurt.netlify.app/img/sun.svg is where it should be available, but it’s not.
There isn’t any issue when I try running it locally using netlify dev, only happens on the remote Netlify deploy.

The address you mention does exist:


Is this not correct?

1 Like

I rechecked on my phone now and it’s showing sun.svg. However it’s still doesn’t load up on the PC. Any idea why this could be happening?

I doubt it might be caching it on the browser because I’m using localStorage to save the counter index and colour preference. I’m only taking a guess.

Have you checked using a private/incognito browser window?

If it’s just index and colour preference, that chances are less that it might be due to that, but it’s always better to be sure by checking like @coelmay mentioned.