Discussion about adding experimental spaces in Sanity.json and resolving issues with switching between them.
16 replies
Last updated: Nov 5, 2021
D
HI Team,I just added two sanity spaces adding this "__experimental_spaces” code into sanity.json
{
"root": true,
"api": {
"projectId": "********",
"dataset": "production"
},
"project": {
"name": "Sample"
},
"__experimental_spaces": [
{
"name": "production",
"title": "Prod",
"default": true,
"api": {
"projectId": "********",
"dataset": "production"
}
},
{
"name": "staging",
"title": "Staging",
"api": {
"projectId": "********",
"dataset": "testsanity"
}
}
],
"plugins": [
"@sanity/base",
"@sanity/default-layout",
Now I can see a dropdown next to my project name, when I’m switching from ‘prod’ to ‘staging’ from above dropdown, url is got change to
http://localhost:3333/staging/desk/docs but drop down value is still prod and I can see data in my production dataset(because I created my ‘testsanity’ dataset just now, so this should be empty). Any reason to behave like this?
{
"root": true,
"api": {
"projectId": "********",
"dataset": "production"
},
"project": {
"name": "Sample"
},
"__experimental_spaces": [
{
"name": "production",
"title": "Prod",
"default": true,
"api": {
"projectId": "********",
"dataset": "production"
}
},
{
"name": "staging",
"title": "Staging",
"api": {
"projectId": "********",
"dataset": "testsanity"
}
}
],
"plugins": [
"@sanity/base",
"@sanity/default-layout",
Now I can see a dropdown next to my project name, when I’m switching from ‘prod’ to ‘staging’ from above dropdown, url is got change to
http://localhost:3333/staging/desk/docs but drop down value is still prod and I can see data in my production dataset(because I created my ‘testsanity’ dataset just now, so this should be empty). Any reason to behave like this?
Nov 4, 2021, 5:03 PM
R
It looks like you have an extra
apisetting above your
experimental_spaces. Do you still get this behavior if you remove it?
Nov 4, 2021, 11:57 PM
D
when I execute 'sanity deploy' command after removing extra api section from above sanity.json file following error will returnPS D:\*****-docs-cms> sanity deploy
Error: "D:/****/sanity.json" does not contain a project identifier ("api.projectId"), which is required for the Sanity CLI to communicate with the Sanity API
Error: "D:/****/sanity.json" does not contain a project identifier ("api.projectId"), which is required for the Sanity CLI to communicate with the Sanity API
Nov 5, 2021, 12:08 AM
D
when I execute 'sanity deploy' command after removing extra api section from above sanity.json file following error will returnPS D:\*****-docs-cms> sanity deploy
Error: "D:/****/sanity.json" does not contain a project identifier ("api.projectId"), which is required for the Sanity CLI to communicate with the Sanity API
Error: "D:/****/sanity.json" does not contain a project identifier ("api.projectId"), which is required for the Sanity CLI to communicate with the Sanity API
Nov 5, 2021, 12:08 AM
R
can you copy and paste your
sanity,jsonhere?
Nov 5, 2021, 12:10 AM
D
{ "root": true,
"project": {
"name": "sample"
},
"__experimental_spaces": [
{
"name": "production",
"title": "Prod",
"default": true,
"api": {
"projectId": "******",
"dataset": "production"
}
},
{
"name": "staging",
"title": "Staging",
"api": {
"projectId": "********",
"dataset": "testsanity"
}
}
],
"plugins": [
"@sanity/base",
"@sanity/default-layout",
"@sanity/default-login",
"@sanity/desk-tool",
"@sanity/code-input",
"markdown",
"@sanity/color-input"
],
"env": {
"development": {
"plugins": [
"@sanity/vision"
]
}
},
"parts": [
{
"name": "part:@sanity/base/schema",
"path": "./schemas/schema"
}
]
}
"project": {
"name": "sample"
},
"__experimental_spaces": [
{
"name": "production",
"title": "Prod",
"default": true,
"api": {
"projectId": "******",
"dataset": "production"
}
},
{
"name": "staging",
"title": "Staging",
"api": {
"projectId": "********",
"dataset": "testsanity"
}
}
],
"plugins": [
"@sanity/base",
"@sanity/default-layout",
"@sanity/default-login",
"@sanity/desk-tool",
"@sanity/code-input",
"markdown",
"@sanity/color-input"
],
"env": {
"development": {
"plugins": [
"@sanity/vision"
]
}
},
"parts": [
{
"name": "part:@sanity/base/schema",
"path": "./schemas/schema"
}
]
}
Nov 5, 2021, 12:11 AM
D
{ "root": true,
"project": {
"name": "sample"
},
"__experimental_spaces": [
{
"name": "production",
"title": "Prod",
"default": true,
"api": {
"projectId": "******",
"dataset": "production"
}
},
{
"name": "staging",
"title": "Staging",
"api": {
"projectId": "********",
"dataset": "testsanity"
}
}
],
"plugins": [
"@sanity/base",
"@sanity/default-layout",
"@sanity/default-login",
"@sanity/desk-tool",
"@sanity/code-input",
"markdown",
"@sanity/color-input"
],
"env": {
"development": {
"plugins": [
"@sanity/vision"
]
}
},
"parts": [
{
"name": "part:@sanity/base/schema",
"path": "./schemas/schema"
}
]
}
"project": {
"name": "sample"
},
"__experimental_spaces": [
{
"name": "production",
"title": "Prod",
"default": true,
"api": {
"projectId": "******",
"dataset": "production"
}
},
{
"name": "staging",
"title": "Staging",
"api": {
"projectId": "********",
"dataset": "testsanity"
}
}
],
"plugins": [
"@sanity/base",
"@sanity/default-layout",
"@sanity/default-login",
"@sanity/desk-tool",
"@sanity/code-input",
"markdown",
"@sanity/color-input"
],
"env": {
"development": {
"plugins": [
"@sanity/vision"
]
}
},
"parts": [
{
"name": "part:@sanity/base/schema",
"path": "./schemas/schema"
}
]
}
Nov 5, 2021, 12:11 AM
R
Which version of the Studio are you running?
Nov 5, 2021, 12:13 AM
D
mmm where can I find it
Nov 5, 2021, 12:14 AM
D
"dependencies": { "@sanity/base": "^2.21.0",
"@sanity/block-content-to-markdown": "^0.0.5",
"@sanity/code-input": "^2.21.1",
"@sanity/color-input": "^2.21.2",
"@sanity/core": "^2.21.0",
"@sanity/default-layout": "^2.21.0",
"@sanity/default-login": "^2.21.0",
"@sanity/desk-tool": "^2.21.0",
"@sanity/vision": "^2.21.0",
"get-video-id": "^3.4.1",
"get-youtube-id": "^1.0.1",
"prop-types": "^15.7",
"react": "^17.0",
"react-dom": "^17.0",
"sanity-plugin-markdown": "^2.0.2",
"styled-components": "^5.2.0"
}
"@sanity/block-content-to-markdown": "^0.0.5",
"@sanity/code-input": "^2.21.1",
"@sanity/color-input": "^2.21.2",
"@sanity/core": "^2.21.0",
"@sanity/default-layout": "^2.21.0",
"@sanity/default-login": "^2.21.0",
"@sanity/desk-tool": "^2.21.0",
"@sanity/vision": "^2.21.0",
"get-video-id": "^3.4.1",
"get-youtube-id": "^1.0.1",
"prop-types": "^15.7",
"react": "^17.0",
"react-dom": "^17.0",
"sanity-plugin-markdown": "^2.0.2",
"styled-components": "^5.2.0"
}
Nov 5, 2021, 12:14 AM
D
{ "name": "*******",
"private": true,
"version": "1.0.0",
"description": "",
"main": "package.json",
"author": "********",
"license": "UNLICENSED",
"scripts": {
"start": "sanity start",
"build": "sanity build"
},
"keywords": [
"sanity"
],
"dependencies": {
"@sanity/base": "^2.21.0",
"@sanity/block-content-to-markdown": "^0.0.5",
"@sanity/code-input": "^2.21.1",
"@sanity/color-input": "^2.21.2",
"@sanity/core": "^2.21.0",
"@sanity/default-layout": "^2.21.0",
"@sanity/default-login": "^2.21.0",
"@sanity/desk-tool": "^2.21.0",
"@sanity/vision": "^2.21.0",
"get-video-id": "^3.4.1",
"get-youtube-id": "^1.0.1",
"prop-types": "^15.7",
"react": "^17.0",
"react-dom": "^17.0",
"sanity-plugin-markdown": "^2.0.2",
"styled-components": "^5.2.0"
}
}
"private": true,
"version": "1.0.0",
"description": "",
"main": "package.json",
"author": "********",
"license": "UNLICENSED",
"scripts": {
"start": "sanity start",
"build": "sanity build"
},
"keywords": [
"sanity"
],
"dependencies": {
"@sanity/base": "^2.21.0",
"@sanity/block-content-to-markdown": "^0.0.5",
"@sanity/code-input": "^2.21.1",
"@sanity/color-input": "^2.21.2",
"@sanity/core": "^2.21.0",
"@sanity/default-layout": "^2.21.0",
"@sanity/default-login": "^2.21.0",
"@sanity/desk-tool": "^2.21.0",
"@sanity/vision": "^2.21.0",
"get-video-id": "^3.4.1",
"get-youtube-id": "^1.0.1",
"prop-types": "^15.7",
"react": "^17.0",
"react-dom": "^17.0",
"sanity-plugin-markdown": "^2.0.2",
"styled-components": "^5.2.0"
}
}
Nov 5, 2021, 12:16 AM
R
Ok, revert your
sanity.jsonback to the original. That wasn't the issue. If you restart your Studio completely do you still get this behavior?
Nov 5, 2021, 12:18 AM
R
You may also want to run
sanity upgradeto get on the latest version.
Nov 5, 2021, 12:19 AM
D
Thank you very much 🙌, it's got resolved once 'sanity upgrade' and next 'npm install' command. 🎉
Nov 5, 2021, 1:06 AM
D
Thank you very much 🙌, it's got resolved once 'sanity upgrade' and next 'npm install' command. 🎉
Nov 5, 2021, 1:06 AM
R
Awesome! So glad it's working!
Nov 5, 2021, 1:17 AM
R
Awesome! So glad it's working!
Nov 5, 2021, 1:17 AM
Sanity– build remarkable experiences at scale
The Sanity Composable Content Cloud is the headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.