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

All non-root pages trigger /404 navigation fallback when deployed to Vercel. #54

Open
kelvindecosta opened this issue Sep 15, 2024 · 4 comments

Comments

@kelvindecosta
Copy link

Overview

Pages other than the home page (/), do not get rendered correctly.
Instead, the navigation fallback, which is /404 in this case is shown.

Reproduction

Relevant links:

Steps to recreate:

  • Setup a basic astro starter with the recommended template files
  • Add vercel adapter
  • Add @vite-pwa/astro and @vite-pwa/assets-generator plugins

Key Observations

  • At this point in the repository, the site is in output: "static" and the issue was not observed.
  • After converting the app to a hybrid one, the issue is observed first

Related Issues

Other Minor Issues

  • For some reason, the assets generator doesn't add the output to the .vercel/output/static directory. A workaround is to call the generator via the CLI and then commit the generated files (in public).
  • The experimental directoryAndTrailingSlashHandler doesn't seem to work on the home page when configured for no trailing slashes.

Conclusion

I'm not sure how to continue debugging the issue here.
Since we use server endpoints, we need output: "hybrid".

I will appreciate any help and feedback.
Thank you for your time and for maintaining this project 🎈

@userquin
Copy link
Member

userquin commented Sep 15, 2024

If you use server pages and api endpiints you should add these urls to navigateFallbackDenylist regex array, check this issue vite-pwa/sveltekit#65

@kelvindecosta
Copy link
Author

Hey @userquin, thank you for your response!

In the reproduction repository and live website, the issue happens for static pages too.
The / home page links to /second-page which triggers a /404 even though it is by default pre-rendered.

@userquin
Copy link
Member

I Will try to check your repo tmr.

@userquin
Copy link
Member

userquin commented Sep 20, 2024

The sw installation is failing (check console errors), it seems we cannot use 404 when using hybrid mode since astro not exposing it as url (open https://pwa-repro.vercel.app/404 in private browsing: vercel response is 404). You will need to change the navigateFallback to root page.

(I cannot run preview script on my local, some vercel stuff required)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants