BLOG-261 Fix Supply Sentry auth token to frontend build to enable log and sourcemap uploads #265
Reference in New Issue
Block a user
Delete Branch "BLOG-261_fix_sentry_logs_are_not_sent"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description
Summary
This resolves the issue where Sentry logs and source maps were failing to upload during the deployment pipeline (BLOG-261). The core problem was that the frontend build environment lacked the necessary authentication credentials to communicate with the Sentry API. I've updated the deployment workflow to pass the
SENTRY_AUTH_TOKENfrom our CI secrets into the Docker build context, and updated the frontend Dockerfile to securely mount and utilize this token during the build phase. A minor descriptive adjustment was also made to our pre-commit config.Key Changes
.gitea/workflows/deployment.yaml: Injected theSENTRY_AUTH_TOKENinto the build container's secrets configuration.frontend/Dockerfile: Configured secure secret mounting (--mount=type=secret) to readSENTRY_AUTH_TOKENand expose it as an environment variable specifically during thepnpm run buildexecution..pre-commit-config.yaml: Renamed thefrontend-linthook from "frontend lint" to "frontend lint & check" to better reflect its underlying script behavior.Testing/Review Notes
Package Changes
No response
Screenshots
No response
Reference
Resolves #261.
Checklist
/improve
PR Code Suggestions ✨
Conditionally set secret environment variable
The current command sets
SENTRY_AUTH_TOKENto an empty string if the secret is notavailable, which can cause Sentry tooling to fail as an empty token is often treated
as an invalid value. It is safer to only set the environment variable if the secret
file exists, ensuring the build can proceed without Sentry features when the token
is not supplied.
frontend/Dockerfile [15-17]
Suggestion importance[1-10]: 7
__
Why: The suggestion correctly identifies a potential issue where setting
SENTRY_AUTH_TOKENto an empty string could cause the build to fail if Sentry tooling treats it as an invalid token. The proposed change to only set the variable if the secret file exists makes the build process more robust, especially for local builds where the secret might not be present.