Sebastian Meckovski
Sebastian Meckovski

Reputation: 278

Sanity Deployment in Azure Pipeline

I'm trying to deploy my sanity react app, here's the repo: https://github.com/sebastian-meckovski/sanity-admin-area

here's my yml file:

trigger:
- main
- feature/*

pool:
  vmImage: 'ubuntu-latest'

variables:
 SANITY_AUTH_TOKEN: $(SanityDeployAPIToken)
 SANITY_STUDIO_PROJECT_BASEPATH: /studio

steps:
- task: NodeTool@0
  inputs:
    versionSpec: '14.x'
- task: CmdLine@2
  inputs:
    script: |
      cd src/Studio
      npm install -g @sanity/cli
      npm install
      sanity deploy

been using this article for help: https://blog.novacare.no/deploy-sanity-studio-with-azure-devops/

I'm getting this error in cmdline in azure:

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.

any ideas?

Upvotes: 1

Views: 572

Answers (1)

Leo Liu
Leo Liu

Reputation: 76860

Sanity Deployment in Azure Pipeline

That is because you would be asked to choose a unique hostname for your Studio when you first deploy sanity.

This is a pop-up verification window that needs to interact with our developers.

But the hosted agent is in the service mode instead of Interactive. Please check the docuement Azure Pipelines agents for some more details.

In this case, the verification window will not pop-up for the hosted agent. That is the reason why you get the error the project has not been assigned a studio hostname.

To resolve this issue, you need to create your private agent and set it as Interactive mode.

Self-hosted Linux agents

Or you could just deploy it from your local with command line, so that you could assign a studio hostname.

Of course, a more complete solution would be to have Sanity pre-specify the hostname somewhere (a json-like file) and then read it when deploying Sanity without specifying it during the process. But I'm not a Sanity expert and it's not clear if there is such a way.

Upvotes: 1

Related Questions