Getting Consistent Errors on First Day Using Sanity - Demo Also Failing

4 replies
Last updated: Aug 14, 2023
Hello
Hope you're all doing well. I wanted to reach out because I've been giving "Sanity" a shot for the first time today, but unfortunately, I've been encountering some issues. I've attached a photo that shows the error I've been consistently getting throughout the day.
I've even attempted using one of the working demos provided on the website, thinking it might be an isolated case, but to my surprise, I encountered the same problem.
I'm really excited about using "Sanity" and its potential, so I'm hoping we can figure out what might be causing this hiccup. If anyone has any insights or suggestions, I'm all ears and would greatly appreciate the assistance.
AI Update

I'd be happy to help you troubleshoot this! Since you mentioned you've attached a photo but I can't see it in this format, I'll cover the most common issues people encounter when first starting with Sanity.

First, check the Sanity Status Page to make sure there aren't any ongoing service issues today. This is always a good first step when experiencing problems.

Most Common Issue: CORS Configuration

The most frequent problem new users encounter is related to CORS (Cross-Origin Resource Sharing) origins not being configured. This typically shows up as errors like:

  • "No 'Access-Control-Allow-Origin' header is present"
  • "Blocked by CORS policy"
  • "Access-Control-Allow-Credentials must be 'true'"

Here's how to fix it:

  1. Go to manage.sanity.io
  2. Select your project
  3. Navigate to Settings β†’ API β†’ CORS Origins
  4. Add your domain (for local development, add http://localhost:3000 or whatever port you're using)
  5. Important: Check the "Allow credentials" box if you're using authentication tokens

Make sure to include the full URL with protocol (http:// or https://) - they need to match exactly. Even the difference between http:// and https:// matters!

Other Common First-Time Issues:

  • Authentication: Make sure you're logged in by running sanity login in your terminal
  • Node.js version: Sanity Studio v4 requires Node.js 20 or higher
  • Missing dependencies: Try running npm install or yarn install again
  • Project configuration: Verify your sanity.config.ts or sanity.json has the correct project ID and dataset name

If you can describe the specific error message you're seeing (or paste the text from the error), I can give you more targeted help! Common error messages usually point directly to the solution.

For the demos on the website, if those are also failing, it's most likely a CORS issue with your browser, a network/firewall restriction, or potentially a service issue (hence checking the status page first).

Welcome to Sanity - once you get past this initial hurdle, you'll find it's a really powerful platform! πŸŽ‰

Show original thread
4 replies
Hi Roy, have you had a chance to look at this discussion to see if any of the scenarios that are causing this issue is applicable to you?
I discovered that neither the VPN nor Firewall was causing the problem for me. Instead, I resolved the issue by disabling the Web Protection features in Avira Antivirus and following this guide: https://youtu.be/TI95846k1h8 . While I did both steps simultaneously, I suspect that the Web Protection feature in Avira Antivirus was likely the culprit, as many similar issues seem to be related to antivirus software.
Thanks for sharing your findings with the community πŸ‘
No problem, loving sanity as a first time user πŸ”₯

Sanity – Build the way you think, not the way your CMS thinks

Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.

Was this answer helpful?