Skip to content

Conversation

@singh-inder
Copy link
Contributor

@singh-inder singh-inder commented Jan 7, 2026

What kind of change does this PR introduce?

Bug fix #4689

What is the new behavior?

LoadProfile is called before awsRegions are loaded.

Additional context

region var is initialized at package scope in projects.go. As regions are scoped to profile now (#4596), at this point the current profile isn't loaded yet so the region.Allowed is set to empty slice. LoadProfile is called inside rootCmd.PersistentPreRunE which runs after flag parsing and flag validation.

Marking this as a draft for now to get early feedback from maintainers. Happy to adjust the approach if there's a preferred pattern here.

@coveralls
Copy link

coveralls commented Jan 7, 2026

Pull Request Test Coverage Report for Build 20786460683

Details

  • 0 of 9 (0.0%) changed or added relevant lines in 2 files are covered.
  • 8 unchanged lines in 2 files lost coverage.
  • Overall coverage decreased (-0.05%) to 55.992%

Changes Missing Coverage Covered Lines Changed/Added Lines %
cmd/branches.go 0 2 0.0%
internal/utils/profile.go 0 7 0.0%
Files with Coverage Reduction New Missed Lines %
internal/debug/postgres.go 3 66.09%
internal/gen/keys/keys.go 5 12.9%
Totals Coverage Status
Change from base Build 20781802512: -0.05%
Covered Lines: 6845
Relevant Lines: 12225

💛 - Coveralls

Copy link
Contributor

@sweatybridge sweatybridge left a comment

Choose a reason for hiding this comment

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

Looks good! just did some minor refactoring

@sweatybridge sweatybridge marked this pull request as ready for review January 7, 2026 13:38
@sweatybridge sweatybridge requested a review from a team as a code owner January 7, 2026 13:38
@sweatybridge
Copy link
Contributor

sweatybridge commented Jan 7, 2026

I did more testing and found that it doesn't actually work. Reason is we need to parse the --profile flag to know which profile to load, but if we let cobra parse all flags, it will also include the enum flag that depends on the current profile. so it's a catch-22.

let me see if there's another alternative

currently settling on a static list of regions to unblock

@sweatybridge sweatybridge changed the title fix: load profile before initializing awsRegions fix: use static list of project regions Jan 7, 2026
@sweatybridge sweatybridge merged commit 05d91ef into supabase:develop Jan 7, 2026
11 of 12 checks passed
@singh-inder singh-inder deleted the fix-project-region-flag branch January 7, 2026 15:38
@singh-inder
Copy link
Contributor Author

🤦‍♂️ Yeah, I completely overlooked --profile flag. sorry about that.

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.

Create project via the cli not working with --region flag

3 participants