User missing sanity.project/update grant when deploying Studio
The error User is missing required grant sanity.project/update to perform this operation indicates an authentication or permissions issue with your deployment. Here's how to resolve it:
The Core Issue
This error means the credentials you're currently using don't have the necessary permissions to deploy the Studio. Even though you've tried using admin and deploy tokens in your .env file, something isn't authenticating correctly.
Solution Steps
1. Clear your current authentication and log in interactively:
npx sanity logout
npx sanity loginThe sanity login command will open a browser window for you to authenticate with your Sanity account. This ensures you're using proper credentials with the right permissions.
2. Verify your account has the right project role:
According to the Sanity access control documentation, you need Administrator role to deploy. Check your role in your project settings on sanity.io. Contributors, Viewers, or Editors won't have deployment permissions.
3. Try deploying again:
yarn sanity deployAbout Using Tokens
The sanity deploy documentation mentions that tokens can be used for deployment via the SANITY_AUTH_TOKEN environment variable, particularly in CI/CD environments. However, if you're getting this error with tokens, the token itself likely doesn't have the correct permissions, or there's a conflict between your environment variables and CLI authentication.
Additional Troubleshooting
If logging in interactively doesn't resolve the issue:
- Double-check your
sanity.config.js: Ensure theprojectIdmatches the project you have Administrator access to - Remove conflicting environment variables: Temporarily unset
SANITY_AUTH_TOKENfrom both your.envfile and actual environment variables while using interactive login - Verify your CLI version: Update to the latest version with
npm install -g sanity@latest - Check you're in the right directory: Make sure you're running the command from your Studio's root directory
Once you successfully deploy with interactive login, you can then set up automated deployments with tokens in CI/CD pipelines if needed.
Show original thread3 replies
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.