Skip to content

Error when running "backup" demo: Session not found. You may need to login again with sanity login. #23

@newt-beach

Description

@newt-beach

Describe the bug

I get the following message trying to run the backup demonstration in the README:
Error: Unauthorized - Session not found. You may need to login again with sanity login.

I have set SANITY_AUTH_TOKEN in my repository secrets. I have tried using several Sanity API tokens: one with the deploy-studio designation, one developer token and one viewer token. However, they all throw the same error.

According to the docs this message could mean:

    - A temporary issue, please try to run your command again.
    - You have specified an invalid token with the SANITY_AUTH_TOKEN env variable.
    - The session timed out. Try to log out and log in again with the sanity logout and sanity login CLI commands.
    - There was an issue with your logged in user. Try to logout and login again.

I'm confused here because my understanding of deploy tokens is that sanity login shouldn't be required. So, reasons 3 & 4 don't apply when I get that error using a deploy token.

To Reproduce
I copied the code from the "backup" demo in the readme, with a small modification to run the workflow manually instead of on a cron job. Here is the full code of my workflow:

name: "Backup prod CMS"
on:
  workflow_dispatch:
jobs:
  backup-dataset:
    runs-on: ubuntu-latest
    name: Backup dataset
    steps:
      - uses: actions/checkout@v2
      - run: yarn install
      - name: Export dataset
        uses: sanity-io/github-action-sanity@v0.7-alpha
        env:
          SANITY_AUTH_TOKEN: ${{ secrets.SANITY_AUTH_TOKEN }}
        with:
          args: dataset export production backups/backup.tar.gz
      - name: Upload backup.tar.gz
        uses: actions/upload-artifact@v2
        with:
          name: backup-tarball
          path: backups/backup.tar.gz
          # Fails the workflow if no files are found; defaults to 'warn'
          if-no-files-found: error

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions