Skip to content

fix(strr-api): use cloud run service account for gcs uploads#1505

Merged
Jacky-Pham merged 9 commits intomainfrom
uploaddocumentfix
Apr 22, 2026
Merged

fix(strr-api): use cloud run service account for gcs uploads#1505
Jacky-Pham merged 9 commits intomainfrom
uploaddocumentfix

Conversation

@Jacky-Pham
Copy link
Copy Markdown
Collaborator

Issue: Long term fix for bad gateway issues regarding document upload

  • bcgov/entity/issues/

Description of changes:

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the BC Registry and Digital Services BSD 3-Clause License

Copy link
Copy Markdown
Collaborator

@JazzarKarim JazzarKarim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

Copy link
Copy Markdown
Collaborator

@bolyachevets bolyachevets left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you are not going to use the key in cloudrun, might as well not load it from 1password into the build, i.e. remove it from:

GCP_AUTH_KEY="op://buckets/$APP_ENV/strr/GCP_AUTH_KEY"

auth_key = current_app.config.get("GCP_AUTH_KEY")

if current_app.config.get("DEPLOYMENT_PLATFORM") == "GCP" or not auth_key:
storage_client = storage.Client(project=project_id)
Copy link
Copy Markdown
Collaborator

@jimmypalelil jimmypalelil Apr 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Jacky-Pham

  1. won't devs still require a GCP_AUTH_KEY for local development? Devs can copy the key from here for access to dev bucket.
  2. sanity check: Is the permission on the bucket setup such that the Cloud Run SA can access it for this to work? Confirmed with @Jacky-Pham offline that the GCP_AUTH_KEY was created from the Cloud Run role of the strr-api-* service so permission should already be set up.

Comment thread strr-api/src/strr_api/services/gcp_storage_service.py Outdated
@dimak1
Copy link
Copy Markdown
Collaborator

dimak1 commented Apr 14, 2026

@Jacky-Pham Do we need this PR in next release? There are some unresolved comments.

@Jacky-Pham
Copy link
Copy Markdown
Collaborator Author

@dimak1 No this is not necessary for the next release. I can fix these up for next release

JWT_OIDC_ISSUER="op://keycloak/$APP_ENV/jwt-base/JWT_OIDC_ISSUER"
JWT_OIDC_CACHING_ENABLED="op://keycloak/$APP_ENV/jwt-base/JWT_OIDC_CACHING_ENABLED"
JWT_OIDC_ALGORITHMS="op://keycloak/$APP_ENV/jwt-base/JWT_OIDC_ALGORITHMS"
GCP_AUTH_KEY="op://buckets/$APP_ENV/strr/GCP_AUTH_KEY"
Copy link
Copy Markdown
Collaborator

@bolyachevets bolyachevets Apr 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also need to remove this from config.py:

GCP_AUTH_KEY = os.getenv("GCP_AUTH_KEY")
or probably add a fallback default value, if you want to use the key locally

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

made appropriate changes please confirm

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i dont see any changes in config.py
Screenshot 2026-04-15 at 4 07 19 PM

@sonarqubecloud
Copy link
Copy Markdown

@Jacky-Pham Jacky-Pham merged commit c78addb into main Apr 22, 2026
16 checks passed
@dimak1 dimak1 mentioned this pull request Apr 23, 2026
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants