speedplane
speedplane

Reputation: 16141

App Engine Deploy: credentials file not writable. ... Opening in read-only mode. ... Any refreshed credentials will only be valid for this run

I recently upgraded my cloud SDK, and now I can no longer deploy to app engine flexible. I deploy my app with the following command:

C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\bin\gcloud.cmd preview app deploy --promote vm.yaml

I am getting get the following output and crash (abridged):

WARNING: Could not acquire lock C:\Users\Michael\AppData\Roaming\gcloud\credentials.lock in 0 seconds
WARNING: The credentials file (C:\Users\Michael\AppData\Roaming\gcloud\credentials) is not writable. Opening in read-only mode. Any refreshed credentials will only be valid for this run.
WARNING: Could not acquire lock C:\Users\Michael\AppData\Roaming\gcloud\credentials.lock in 0 seconds
WARNING: The credentials file (C:\Users\Michael\AppData\Roaming\gcloud\credentials) is not writable. Opening in read-only mode. Any refreshed credentials will only be valid for this run.
WARNING: Could not acquire lock C:\Users\Michael\AppData\Roaming\gcloud\credentials.lock in 0 seconds
WARNING: The credentials file (C:\Users\Michael\AppData\Roaming\gcloud\credentials) is not writable. Opening in read-only mode. Any refreshed credentials will only be valid for this run.
...
ERROR: gcloud crashed (OSError): [Errno 13] Permission denied: 'C:\\Users\\Michael\\AppData\\Roaming\\gcloud\\credentials.lock'

If you would like to report this issue, please run the following command:
  gcloud feedback

Below is some of the output from gcloud feedback

Trace:
C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\gcloud_main.py:171
 gcloud_cli.Execute()
C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\calliope\cli.py:719
 result = args.calliope_command.Run(cli=s...
C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\calliope\backend.py:1404
 resources = command_instance.Run(args)
C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\surface\app\deploy.py:91
 return deploy_util.RunDeploy(self, args,...
C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\command_lib\app\deploy_util.py:206
 service, code_bucket_ref)
C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\api_lib\app\deploy_app_command_util.py:233
 _UploadFiles(files_to_upload, bucket_ref...
C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\api_lib\app\deploy_app_command_util.py:175
 results = pool.map(_UploadFile, tasks)
c:\Python27\lib\multiprocessing\pool.py:251
 return self.map_async(func, iterable, ch...
c:\Python27\lib\multiprocessing\pool.py:567
 raise self._value
OSError: [Errno 13] Permission denied: 'C:\\Users\\Michael\\AppData\\Roaming\\gcloud\\credentials.lock'


Installation information:

Google Cloud SDK [120.0.0]

Platform: [Windows, x86_64]
Python Version: [2.7.11 (v2.7.11:6d1b6a68f775, Dec  5 2015, 20:32:19) [MSC v.1500 32 bit (Intel)]]
Python Location: [c:\Python27\python.exe]
[output truncated]

Any ideas?

Upvotes: 1

Views: 1215

Answers (4)

Hello World
Hello World

Reputation: 1

The better way is to solve this error is to reinstall after deleting the root directory where lock file is.

Upvotes: 0

samkelo jiyane
samkelo jiyane

Reputation: 1

I've also ran into this issue as well. How it happened --> I ran gcloud app deploy command, but later realised that the deployment took much longer to finish (perhaps hanging), then I killed the batch process i.e. CTRL +C. When I reissued the command thats when I got into this issue. So the SOLUTION, do what's already said above i.e. go and delete the credentials.lock file (in my case it found in C:\Users\Sam\AppData\Roaming\gcloud directory)

Upvotes: 0

KayMagnum
KayMagnum

Reputation: 11

I recently had the same issue. Go to the directory shown in the error message. You'd find two credientials files. Delete the one with the LOCK extension( it would be the empty one). Then redeploy your project. Worked perfectly for me.

Upvotes: 1

speedplane
speedplane

Reputation: 16141

This is a bug with the Google SDK's parallel upload feature introduced in June 2016. Work-around the bug by turning off the feature with the following command:

gcloud config set app/num_file_upload_processes 1

The command above limits the number of parallel uploads to 1 thread/process, so they don't step on each other's feet.

Upvotes: 5

Related Questions