sanity-io / sanity

Sanity Studio – Rapidly configure content workspaces powered by structured content
https://www.sanity.io
MIT License
5.27k stars 427 forks source link

Astro with Sanity gives 404 when refreshing the studio #6479

Closed layout-ch closed 5 months ago

layout-ch commented 6 months ago

Dear Sanity Support Team, I hope this message finds you well. I am currently experiencing a recurring issue with my Sanity / Astro.js setup, and I would appreciate your assistance in resolving it. Issue Description: I have set up Sanity Studio under the path mywebsite.com/studio. The initial access and navigation work as expected, redirecting correctly to mywebsite.com/studio/structure. However, I encounter a significant problem when I refresh the page: it results in a 404 error, indicating that the page cannot be found. Steps to Reproduce:

  1. Access the Sanity Studio at mywebsite.com/studio.
  2. The page automatically redirects to mywebsite.com/studio/structure.
  3. Refresh the page at mywebsite.com/studio/structure.
  4. A 404 error is displayed.

I understand from community discussions that one potential workaround might involve reverting to version 2.2.1 of the software. However, considering the advancements and features introduced in the latest versions, downgrading seems like an undesirable solution. Maintaining the ability to refresh pages without encountering errors seems fundamental, and I am hoping there might be an alternative solution that allows us to utilize the latest version effectively. Could you please advise if there is another approach or fix that could resolve this issue without needing to downgrade? Your guidance on how to maintain the stability and functionality of our current setup would be greatly appreciated.

Thank you for your time and assistance.

largis21 commented 6 months ago

You have to use a rest route, i.e [...studio] not [studio]

layout-ch commented 5 months ago

its in the astro.config that you define the route, but apparently a known bug that came with the sanity-astro 3.0.0...

christianhg commented 5 months ago

Exactly. Please try out v 3.0.1 of @sanity/astro. It should solve the problem.

github-actions[bot] commented 2 months ago

This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread.