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

Time:12-18

As title states, whenever I deploy my app, the entire three.js project deploys perfectly but 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. I am using Vite.js for local running

Github repo - https://github.com/ElijahSchrock/Neo-Runner

Heroku Deploy - https://neo-runner.herokuapp.com/

Here is my package.json

Here is my create character function

Here is Don McCurdy's take on it from the threejs forum https://discourse.threejs.org/t/when-i-deploy-to-heroku-my-deployment-is-successful-but-my-glb-file-receives-404-error/32750/2

And I am also using the static build pack as well as the nodejs buildpack. please help !! Thank you! :)

CodePudding user response:

There is a tiny issue with your path to the glTF asset. Instead of:

loader.load('./Neo.glb', (gltf) => {

you want to use:

loader.load('./model/Neo.glb', (gltf) => {

CodePudding user response:

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

  • Related