Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'Unauthorized - Session does not match project host' (Github actions deployment) #3975

Closed
martyjg opened this issue Dec 15, 2022 · 3 comments
Labels

Comments

@martyjg
Copy link

martyjg commented Dec 15, 2022

Describe the bug

When trying to deploy Sanity from github actions I'm getting the following error

Run npx @sanity/cli deploy
  npx @sanity/cli deploy
  shell: sh -e {0}
  env:
    SANITY_STUDIO_PREVIEW_TOKEN: ***
    SANITY_STUDIO_API_PROJECT_ID: iuuqva9
    SANITY_AUTH_TOKEN: ***
  
- Checking project info

ClientError$1: Unauthorized - Session does not match project host. You may need to login again with sanity login.

I assumed this meant that the deploy and viewer tokens had expired so I created new tokens and added them to the project but it's still happening. I checked and double-checked these.
I understand what 'login again with sanity login' would mean if I was running these from my command line but in the context of deployment / github actions, I don't know what to do here.

To Reproduce

As a step in a github workflow job:

- name: Deploy live studio
        run: npx @sanity/cli deploy
        working-directory: website/cms
        env:
          SANITY_STUDIO_PREVIEW_TOKEN: ${{ secrets.SANITY_STUDIO_PREVIEW_TOKEN }}
          SANITY_STUDIO_API_PROJECT_ID: iuu3qva9
          SANITY_AUTH_TOKEN: ${{ secrets.SANITY_DEPLOY_TOKEN_PRODUCTION }}

Expected behavior

Sanity deploys. I made no changes to the github actions / workflow that could have caused this.

Which versions of Sanity are you using?

package.json:
"@sanity/client": "^3.4.1",

'sanity versions':
@sanity/cli 2.27.0 (latest: 3.0.6)

What operating system are you using?
This is happening on github actions.

Which versions of Node.js / npm are you running?

8.14.0
v16.13.1
@martyjg martyjg changed the title Unauthorized - Session does not match project host (Github actions deployment) 'Unauthorized - Session does not match project host' (Github actions deployment) Dec 15, 2022
@RitaDias RitaDias added the bug label Dec 16, 2022
@bobinska-dev
Copy link

Hello Marty!
Could you please check, that you're not using V3 dependencies in V2?
Which version of Sanity are you using?

BTW: If you want faster help, please consider joining our community and posting the issue there :)

@rexxars
Copy link
Member

rexxars commented Feb 21, 2023

Closing this as we haven't heard back in a while

@rexxars rexxars closed this as completed Feb 21, 2023
@github-actions
Copy link
Contributor

This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants