ERROR: configuration error - GDrive remote auth failed with credentials in 'GDRIVE_CREDENTIALS_DATA'

I am not sure what is going wrong here. I copy pasted the credentials files from my Gdrive service account into the secret GDRIVE_CREDENTIALS_DATA. I can see that the variable is populated when I run GH action. I tried the credentials on two other computers, but not with the environment variable.

ERROR: configuration error - GDrive remote auth failed with credentials in ‘GDRIVE_CREDENTIALS_DATA’.

name: auto-testing
on: [push]
jobs:
  run:
    runs-on: [ubuntu-latest]
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-python@v2
      - uses: iterative/setup-dvc@v1
      - name: sanity-check
        run: |
          dvc pull
          pip install -r requirements.txt
          python src/test.py
        env:
          repo_token: ${{ secrets.GITHUB_TOKEN }}
          GDRIVE_CREDENTIALS_DATA : ${{ secrets.GDRIVE_CREDENTIALS_DATA }}   

Hi,
what Pydrive2 version are you using? If running 1.10.2, could you try downgrading to 1.10.1?

dvc pull runs before I make any changes to the container i.e. before I install dependencies. So, it should be the default version. How can I find out which version is installed?

when I add

pip list | grep pydrive

I get an error.

Sorry, I missed that you were using the setup-dvc action, please disregard my previous comment as it is not relevant to the issue.

Can you get dvc pull working locally when setting GDRIVE_CREDENTIALS_DATA env variable?

Not sure how to do that. The content of the json file is not really suited for a normal environment variable. Because it is JSON. Something like this?

GDRIVE_CREDENTIALS_DATA=’
“{…}”

?

I read somewhere it is better to use the action rather than the docker file. Not sure what is recommended.

Setting the env variable to the content of the json file should be enough, see this guide: Setup Google Drive Remote

GDRIVE_CREDENTIALS_DATA='{...}' (no double quotes).

Thanks, I know that link. It did not really help me to set it up so far. When I do what you showed I get an error in the console:

-bash: printf: `r’: invalid format character

probably from this entry

"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/gh-398%40lrg.iam.gserviceaccount.com"

When I change the $40 to @ it works locally, but not on GH.

Nope, still not working.

Is there anywhere an example file that works??

---
GDRIVE_CREDENTIALS_DATA: *** *** *** *** *** *** *** *** *** *** *** ***
---
ERROR: configuration error - GDrive remote auth failed with credentials in 'GDRIVE_CREDENTIALS_DATA'.
Backup first, remove or fix them, and run again.
It should do auth again and refresh the credentials.
Details:: name: drive  version: v2
ERROR: GDrive remote auth failed with credentials in 'GDRIVE_CREDENTIALS_DATA'.
Backup first, remove or fix them, and run again.
It should do auth again and refresh the credentials.
Details:
Learn more about configuration settings at <https://man.dvc.org/remote/modify>.
Error: Process completed with exit code 251.```

I’m a bit confused. Could you get it working locally? Doing so in a new git/dvc repo would als help rule out other issues.

Something like:

mkdir gdrive_test
cd gdrive_test
git init
dvc init
git add . && git commit -m "initialize dvc"
dvc remote add gdrive  gdrive://<replace your path here>
dvc remote modify gdrive gdrive_use_service_account true
touch examplefile
dvc add examplefile
git commit -m "add example file"
export GDRIVE_CREDENTIALS_DATA='{...}' # replace credentials here
dvc push

Yes, locally it works. But not on GH.

Could you please try to set gdrive_service_account_json_file_path to some random value?
According to

Nope, that did not help. Thanks for the suggestion.