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

Server Islands does not seem to work with basepath #11703

Closed
1 task
sasoria opened this issue Aug 14, 2024 · 6 comments · Fixed by #11712
Closed
1 task

Server Islands does not seem to work with basepath #11703

sasoria opened this issue Aug 14, 2024 · 6 comments · Fixed by #11712
Assignees
Labels
- P3: minor bug An edge case that only affects very specific usage (priority) feat: server islands Related to Server Islands (scope)

Comments

@sasoria
Copy link
Contributor

sasoria commented Aug 14, 2024

Astro Info

Astro                    v4.13.4
Node                     v20.13.1
System                   macOS (arm64)
Package Manager          unknown
Output                   server
Adapter                  @astrojs/node
Integrations             none

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

Server Islands does not seem to work when base is specified in the astro config, i.e

export default defineConfig({
  base: "/path",
  ...
});

The fetch to get the Server Island returns a 404 with the base missing a trailing slash. This happens both when I start the app with:

  • npm run dev
  • npm run preview

In the example above it tries to get the Server Island from: http://localhost:4321/path_server-islands/MyComponent

What's the expected result?

To fetch the Server Island correctly.

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-4tmst8-5duvgl?file=astro.config.mjs

Participation

  • I am willing to submit a pull request for this issue.
@github-actions github-actions bot added the needs triage Issue needs to be triaged label Aug 14, 2024
@sasoria
Copy link
Contributor Author

sasoria commented Aug 14, 2024

When I go to this url: http://localhost:4321/path/_server-islands/MyComponent it returns the following error:

Screenshot 2024-08-14 at 13 37 42

@Princesseuh Princesseuh added feat: server islands Related to Server Islands (scope) - P2: nice to have Not breaking anything but nice to have (priority) - P3: minor bug An edge case that only affects very specific usage (priority) and removed needs triage Issue needs to be triaged - P2: nice to have Not breaking anything but nice to have (priority) labels Aug 14, 2024
@matthewp matthewp self-assigned this Aug 14, 2024
@matthewp
Copy link
Contributor

We have tests for base actually, this is surprising. I'll take a look.

@matthewp
Copy link
Contributor

Oh, it's specifically when the base doesn't contain the trailing slash. Will fix.

@matthewp
Copy link
Contributor

Hm, our test is the same way. Very odd.

@matthewp
Copy link
Contributor

I see, it's a combination of the base not ending with a trailing slash and trailingSlash config being set to ignore.

@sasoria
Copy link
Contributor Author

sasoria commented Aug 14, 2024

Thank you for fixing this so fast! 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P3: minor bug An edge case that only affects very specific usage (priority) feat: server islands Related to Server Islands (scope)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants