How can I authenticate google cloud sdk onto my docker image?

67 Views Asked by At

My problem is I get an api error when I run my docker image: "ApiError: Anonymous caller does not have storage.objects.get access to the Google Cloud Storage Object.

  • Verified my ServiceAccountKey.json had the correct credentials and IAM roles (Firebase Admin SDK Service Agent, Service Account Token Creator, Storage Admin, Storage Object Admin).

  • on the Docker file I install google Cloud SDK and authenticate it by RUN curl -sSL https://sdk.cloud.google.com | bash ENV PATH $PATH:/root/google-cloud-sdk/bin RUN gcloud auth activate-service-account --key-file=ServiceAccountKey.json RUN gcloud --quiet config set project myproject

  • I have my env variables handled by dotenv and the .env file is copied into the image

  • my image is built without any errors

  • My code works 100% fine locally and works as follows

  1. Triggers on Updates on documents in a collection
  2. Gets a latex template from a bucket
  3. Converts the Latex document to a pdf
  4. Save the pdf into the another bucket for processed pdfs
  5. Email the pdf The docker image is able to look for the update triggers correctly. It even finds the template in the bucket. The issue lies in it not being able to download the template from the bucket because of the ERROR message above
0

There are 0 best solutions below