Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prerendered root page with base path enabled is broken on Netlify #13310

Open
eltigerchino opened this issue Jan 14, 2025 · 1 comment
Open
Labels
bug Something isn't working pkg:adapter-netlify

Comments

@eltigerchino
Copy link
Member

Describe the bug

Having a base path and a prerendered root page deployed to Netlify causes the URL without a trailing slash /base-path to have broken CSS and JS links while the URL with a trailing slash /base-path/ returns the 404 page.

If the root page is not prerendered but we still have a base path, the URL without a trailing slash returns a 404 text response and the URL with a trailing slash successfully returns the root page.

I think the expected outcome is for the URL without a trailing slash to return the root page and the URL with a trailing slash to redirect to the URL without a trailing slash.

Reproduction

  1. Prerender the root page src/routes/+page.svelte
  2. Add a base path to svelte.config.js
  3. Build and deploy to Netlify using the netlify adapter @sveltejs/adapter-netlify

Logs

No response

System Info

.

Severity

serious, but I can work around it

Additional Information

No response

@eltigerchino eltigerchino added pkg:adapter-netlify bug Something isn't working labels Jan 14, 2025
@eltigerchino
Copy link
Member Author

eltigerchino commented Jan 15, 2025

When a base path is set, the root page in builder.prerendered.paths ends with a trailing slash despite the description of the property saying that it doesn't:

/** An array of prerendered paths (without trailing slashes, regardless of the trailingSlash config) */
paths: string[];

This causes the trailing slash path /base-path/ to be excluded from the edge manifest instead of the non-trailing slash path /base-path so it hits the edge function instead of our prerendered page?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working pkg:adapter-netlify
Projects
None yet
Development

No branches or pull requests

1 participant