1

Attempting to list the blobs in a google cloud bucket produces the following error:

TransportError: ("Failed to retrieve
http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/?recursive=true
from the Google Compute Engine metadata service. Status: 404
Response:\nb''", <google.auth.transport.requests._Response object at 0x796af24222f0>)

The error seems similar to one mentioned in this question but their use-case seems quite specific to kubernetes and a bunch of non-related things.

Simple code to reproduce:

storage_client = storage.Client()
bucket = storage_client.bucket(bucket_name='my_bucket')
list(bucket.list_blobs())

Same error for uploading data, downloading data, etc

sapo_cosmico
  • 6,274
  • 12
  • 45
  • 58

1 Answers1

2

Solved it by running the following in colab first:

from google.colab import auth 
auth.authenticate_user()
sapo_cosmico
  • 6,274
  • 12
  • 45
  • 58