svelte-adapter-appengine icon indicating copy to clipboard operation
svelte-adapter-appengine copied to clipboard

MIME type error for deployed online version, not locally

Open Lootwig opened this issue 3 years ago • 6 comments

Even though running vite dev and also vite preview work locally, after deployment both chrome and safari aren't loading the JS due to this error (this is the chrome version, safari uses different wording):

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

I'm not sure whether this is due to a change in the adapter or in sveltekit.

This occurs with adapter version 0.9.1 and sveltekit build 504 - I tried downgrading to 0.9.0 and 477, but the behavior is the same (also, undoing all code changes done in the project since using these older versions does not make a difference).

Lootwig avatar Sep 30 '22 15:09 Lootwig

I am able to reproduce this with a fresh npm create svelte@latest project, the only code change being that I am configuring the appengine adapter. Errors start coming up in the console when attempting to play the "wordle" game contained in the example app.

Lootwig avatar Sep 30 '22 16:09 Lootwig

I also tried appending mime_type: application/javascript to the - url: /_app/immutable/ handler (to see if that would make ALL files receive the content-type: application/javascript header, even CSS stored in immutable) - this seems to have no effect at all

Lootwig avatar Sep 30 '22 16:09 Lootwig

I can see something broke on sep 29th https://github.com/HalfdanJ/svelte-adapter-appengine/actions/runs/3154256956, typically because something changed in sveltekit latest. Until I fix this, try and downgrade to sveltekit released before that date.

HalfdanJ avatar Oct 09 '22 14:10 HalfdanJ

Hmm the test error was due to this issue. It was just because the test app had changed (https://github.com/HalfdanJ/svelte-adapter-appengine/pull/56), so going to need to debug this more.

HalfdanJ avatar Oct 11 '22 21:10 HalfdanJ

@Lootwig I havent been able to reproduce this issue when deploying a vanilla example app from sveltekit (https://e2e-test-dot-svelte-demo-329602.uc.r.appspot.com/). Can you provide any additional details that can help me?

HalfdanJ avatar Oct 14 '22 18:10 HalfdanJ

I'm also being affected by this issue

AlexandruIstrate avatar Jan 09 '23 19:01 AlexandruIstrate