sanity icon indicating copy to clipboard operation
sanity copied to clipboard

Astro with Sanity gives 404 when refreshing the studio

Open layout-ch opened this issue 1 year ago • 1 comments

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.

layout-ch avatar Apr 24 '24 15:04 layout-ch

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

largis21 avatar May 06 '24 06:05 largis21

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

layout-ch avatar May 17 '24 12:05 layout-ch

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

christianhg avatar May 17 '24 12:05 christianhg

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.

github-actions[bot] avatar Aug 16 '24 00:08 github-actions[bot]