kit icon indicating copy to clipboard operation
kit copied to clipboard

1.0.0-next.455 causing broken Netlify response header behavior

Open papiro opened this issue 3 years ago • 4 comments

Describe the bug

With a simple upgrade to @sveltejs/kit from 1.0.0-next.454 to 1.0.0-next.455 with no code changes except the ones needed for the upgrade, the response headers of the pages as served from Netlify are different. I suspect that something changed with the build to where now the netlify.toml is not being read (even though it seems to be detected when looking at the Netlify build logs for the branch).

The response headers (truncated) for an initial html page are changed as follows:

- cache-control: public, max-age=0, must-revalidate
- content-type: text/html; charset=UTF-8
- cross-origin-embedder-policy: require-corp
- cross-origin-opener-policy: same-origin
- strict-transport-security: max-age=31536000; includeSubDomains; preload

+ cache-control: no-cache
+ content-type: text/html
+ link: <./_app/immutable/assets/_layout-7e2cdc5f.css>; rel="preload";as="style"; nopush, <./_app/immutable/assets/modalProvider-2c7dffb9.css>; rel="preload";as="style"; nopush, <./_app/immutable/assets/outputLoadingMessage-6ab61537.css>; rel="preload";as="style"; nopush, <./_app/immutable/assets/tooltip-0a1c217e.css>; rel="preload";as="style"; nopush, <./_app/immutable/start-9e2d9bc6.js>; rel="modulepreload"; nopush, <./_app/immutable/chunks/index-f9b80742.js>; rel="modulepreload"; nopush, ...

The only custom ones set in the netlify.toml are the cross-origin headers you see there (COOP and COEP).

Reproduction

Upgrade from 1.0.0-next.454 to 1.0.0-next.455 and follow the simple changes described here

Logs

No response

System Info

The build image used is the default one in Netlify Ubuntu Focal 20.04.

Severity

blocking an upgrade

Additional Information

No response

papiro avatar Sep 07 '22 01:09 papiro

Please provide a repro as described in the issue template

Rich-Harris avatar Sep 07 '22 05:09 Rich-Harris

https://github.com/papiro/svelte-kit-netlify-issue netlify: https://master--aquamarine-palmier-db1503.netlify.app/

It took me a loooong time to reproduce this. Ultimately the issue is the lack of the +page.ts. I couldn't find anywhere in any threads or docs that a +page.ts is required.

papiro avatar Sep 09 '22 02:09 papiro

I haven't been able to get the old behaviour working, despite countless permutations of kit and adapter-netlify versions, and the provided repro won't build on Netlify at all, so unfortunately I have no idea what changed. The https://master--aquamarine-palmier-db1503.netlify.app/ deployment doesn't appear to be active.

I can't spend any more time on this, so if it's not possible to create a reliable repro then I'm afraid we'll have to close this. For all we can tell, it could be a change to Netlify itself. It seems quite unlikely that a change to Kit would result in this behaviour — far more likely to be a change to adapter-netlify.

Rich-Harris avatar Sep 20 '22 17:09 Rich-Harris

Hmmmm, i left a clean git commit history so you could see what changes i made. Barely any. I apologize i took the site down. Got overzealous cleaning stuff up. I can redeploy it, but it sounds like you're confident this isn't a Svelte-Kit issue anyways. Also, I moved past the issue by creating a +page.ts so it's not an issue which is bothering me any longer so we can close it if you'd like. I'd be okay with that.

papiro avatar Sep 20 '22 18:09 papiro

Closing due to inactivity and we weren't able to reproduce this/determine that it's a SvelteKit issue.

dummdidumm avatar Jan 10 '23 16:01 dummdidumm