"Page not Found" with an error message (in body of message)

Hi guys,

I’m using the Svelte framework. When I attempt to deploy my site on netlify (or any hosting service for that matter), I am met with a “Page not found” and an error in the console which reads: "Failed to load resource: the server responded with a status of 404 (). "

Here is my Github link: GitHub - JustinR1/Dashboard
Here is the Netlify link: https://master--scintillating-sorbet-ce353f.netlify.app/

I’m fairly new to web development and never deployed a page before. I did spend a few hours looking online first before coming here but just can’t figure it out. Oh, and everything works locally.

@zeroproof It’s possible you have a couple of things set incorrectly…

Basic build settings

Make sure that your Basic build settings on Netlify are correct.
Specifically ensure that your Publish directory is dist.
dist is the folder that your npm run build is outputting files to.
Netlify will display the default Page Not Found error when the folder you’ve deployed does not contain an index.html file.

image

Differences between local & Netlify - how to test

Most site builders don’t run precisely the same thing when using their “development” mode compared to their “build” mode, and this is how you can end up thinking “things run locally, but not on Netlify”.

To do a more accurate check, run your build command locally (npm run build), go into your output folder (dist) then serve those static files (npx serve) and see what happens. Provided that your Basic build settings are correct on Netlify, you should see the same thing both on your system and on Netlify.

Asset paths

Your assets (css/js) aren’t being loaded because the paths to them are incorrect:

You can see that they all contain /Phantasma-Dashboard/:

This is something you have set as the base in your vite.config.js:

image

You aren’t serving the files from a folder of /Phantasma-Dashboard/ though.

Checking the files output into dist shows:

image

Hopefully that provides enough detail around “why it’s not working”, for you to configure your project correctly.

1 Like

Hi @nathanmartin ,
Thanks for the prompt and succinct response. Thanks for the little npx serve tip. I went in and changed the line in vite.config.js to /Dashboard/assets which fixed the error in the console.

However, a new error populated in the console: Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of “”. Strict MIME type checking is enforced for module scripts per HTML spec in /src/App.svelte and /src/app.css

@zeroproof I’m not sure what you mean by the path of /Dashboard/assets having fixed your issue, nor can I tell why you’ve chosen that specific value, since I don’t see any folders corresponding to that path in the repository.

Running the build and then serving the static files I still see what I would expect… precisely the same issue, but this time with /Dashboard/assets at the start of the paths, instead of /Phantasma-Dashboard/.

You may actually want your base to just be /, at least when I do that I see:

image

There’s then a JavaScript error in the console, but that just appears to be the code that is running, and you should debug your project as normal.

1 Like

Ok looks like I at least got the content to display here: https://master--subtle-licorice-7dc0e2.netlify.app/

But holy errors batman. None of my javascript works as it did locally. Can’t fetch a damn thing.

Please check the developer console for details:

It provides some insights into errors.

Thank you, I did see that (the holy errors batman lol). Looks like I need to find the dev responsible for the API to use https.

@zeroproof Their API should allow HTTPS, but in the interim you could use a proxy:

/api/*  http://pharpc1.phantasma.io:7077/api/v1/:splat  200
1 Like

It most certainly should. https://pharpc1.phantasma.io:7077 instead loads with an SSL_ERROR_RX_RECORD_TOO_LONG error.

Looking through documentation and examples on phantasma-io/phantasma-ts they always use http:// not https://. Guess they don’t really take security that serious in the blockchain community (or at least this service provider doesn’t.)

@zeroproof might best find a better provider.

1 Like

I think there has been a pretty big overhaul of the blockchain code after a recent audit and a lot of the documentation is being updated/replaced. I’m gonna assume the APIs are being updated. I’ll know more Monday. Thanks again guys for all your help

This is how it should look once those get updated:

1 Like

Thanks, got everything working now with the proxy solution. Appreciated.

thanks for confirming your solution! @zeroproof