feat: enhance error messaging for environment secrets fetching permission#1930
Merged
jeremybeard merged 2 commits intoastronomer:mainfrom Sep 4, 2025
Merged
Conversation
for more information, see https://pre-commit.ci
jeremybeard
approved these changes
Sep 4, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Users encountering environment secrets fetching permission errors during
astro dev start --deployment-id XXXreceive a cryptic error message that provides no actionable guidance for resolution.Current Error Message:
This error occurs when the organization does not have "Environment Secrets Fetching" enabled in organization settings, but users have no way to understand what this means or how to resolve it.
Solution
Enhanced error handling in the environment objects listing flow to detect secrets fetching permission errors and provide specific, actionable troubleshooting guidance.
New Error Message:
Technical Implementation
Changes Made
Enhanced Error Detection (
cloud/environment/environment.go):isSecretsFetchingNotAllowedError()helper function to detect API permission errorslistEnvironmentObjects()to intercept and transform secrets permission errorsComprehensive Testing (
cloud/environment/environment_test.go):TestIsSecretsFetchingNotAllowedError()with 11 test cases covering:Error Detection Logic
The detection function checks for errors containing all three key components:
This ensures precise matching while avoiding false positives from other organization or secrets-related errors.
Testing
Unit Tests
End-to-End Testing
Tested with real deployment ID that triggers the permission error:
This enhancement transforms a confusing technical error into helpful user guidance, improving the developer experience for users setting up local Airflow development with Astro deployments.