When I deploy to Heroku, my deployment is successful but my .glb file receives 404 error

As title states, whenever I deploy my app my .glb file receives the 404 resource not found error. I’m not sure what the issue is. I’ve tried to change the file path but no success.

Github repo - GitHub - ElijahSchrock/Neo-Runner: An Endless Runner Game that allows you to run into the void, dodge obstacles and collect bonuses!
Heroku Deploy - https://neorunner.herokuapp.com/

Might need to ask this question on a Heroku forum – if I try accessing the file directly (https://neo-runner.herokuapp.com/Neo.glb) it’s not there, so there’s nothing wrong with your JavaScript. It seems to be something related to Heroku configuration I guess.

@donmccurdy okay thank you, at least it’s not an error in the code, unfortunately it seems like it’ll be harder to solve now lol. I will open up a question on that forum. I’ve also attempted deploying on Vercel, no luck there either. I appreciate the response! #onward

If you’re using nginx for the server, make sure that you’re allowing .glb mimetype in the nginx config. Something like:

types {
   model/gltf-binary glb;
   model/gltf+json gltf;
   // other types
}
1 Like

It could also have something to do with your .gitignore excluding dist/? I think at least Vercel will not deploy git-ignored files by default. Not sure about Heroku.

attempted this and no luck still receiving the same error

When deploying I never set a nginx config file, do I just add one to my file tree and add that into it? On previous deployments that don’t utilize gltf, the server was built for me and I didn’t need to configure it. I’ll look into setting one

this error has been solved by hosting my files on aws s3 and using that object url in my gltf loader. Make sure to set your CORS correctly

1 Like