Search code examples
terminalzshsanity

Sanity CLI - Studio hostname is already taken


I created a Sanity project on the Sanity studio website manage page at https://www.sanity.io/manage/personal/projects from the project dropdown menu via Select a Project > Create new project:

Sanity studio dropdown

I also created a local Sanity Studio app in my project's directory via the CLI with $ sanity init. The local sanity.config.js file in my studio folder and the project at sanity.io have the same projectId value but the Sanity studio on the website shows status "Not deployed":

Studio not deloyed

When I go to my terminal and type in sanity deloy to deploy via the CLI, I'm prompted to enter a studio hostname:

Your project has not been assigned a studio hostname.
To deploy your Sanity Studio to our hosted Sanity.Studio service,
you will need one. Please enter the part you want to use.
? Studio hostname (<value>.sanity.studio):

When I type in the existing studio hostname for this project I get the error Studio hostname "<my-hostname-here>" is already taken

Documentation for the Sanity CLI is very sparse and lacks basic documentation for most of the CLI commands, including this case. How can I connect my existing local studio to the existing project?


Solution

  • A number of combinations for hostnames that I tried and which were not active projects in my dashboard were showing up as taken.

    So I assume that the hostname must be a completely unique subdomain, not just for your projects but for all Sanity projects.

    I just added my name to the end of the hostname that I wanted and that was accepted and allowed me to deploy.