MIME type error

commandzeta
HOBBY

a year ago

Hi,

After deploying my front-end to Railway, the browser displays the following error in the console, as if Railway was not serving the files correctly.

"Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/html". Strict MIME type checking is enforced for module scripts per HTML spec."

In the network tab, a redirect with status 301 appears for index.html

The problem goes away when reload the page. It only happens the first time a user enters the page after a redeploy, subsequent entries do not throw an error.

Thanks

8 Replies

a year ago

> as if Railway was not serving the files correctly.

Little correction needed here, Railway does not serve files like Vercel or Netlify, on Railway your own application code is responsible for correctly serving files.

With that said, please send a link to where I can see this error.

Either way, this is a config or application level issue.


commandzeta
HOBBY

a year ago


www.pedime.app


a year ago

I'm not seeing any errors in the console logs or networking tab of Chrome's dev tools.

Please send a link to where I can see this error.


commandzeta
HOBBY

a year ago

You should see it there. Please try from another browser. You should get a blank page.


a year ago

Tried with Firefox, no issue.


commandzeta
HOBBY

a year ago

Thanks for your answers. It's weird, I can reproduce it consistently in any browser, I don't understand why you can't. Do you think the location could be a problem?
Even if you can't reproduce it, do you have any idea what might be causing the error?


a year ago

Gonna need more info, can you attach as many screenshots as you see fit that showcase this error?


commandzeta
HOBBY

a year ago

I will try a few more things and I will reach you again if the error persists. Thank you very much for your patience and time!


MIME type error - Railway Help Station