Skip to content

fix(quicksight): Detect identity region via list_namespaces API - #1518

Open
NithinChandranR-AWS wants to merge 1 commit into
aws-solutions-library-samples:mainfrom
NithinChandranR-AWS:fix/qs-identity-region-943
Open

NithinChandranR-AWS wants to merge 1 commit into
aws-solutions-library-samples:mainfrom
NithinChandranR-AWS:fix/qs-identity-region-943

Conversation

@NithinChandranR-AWS

Copy link
Copy Markdown
Contributor

Issue

Fixes #943

Description

Replaces the fragile try/error approach for detecting the QuickSight identity region with the list_namespaces API, which returns the CapacityRegion directly.

Before (current behavior)

  1. Call describe_user in the current region
  2. If it raises AccessDeniedException, parse the error message with a regex to extract the identity region
  3. This is brittle — the error message format could change without notice

After (this PR)

  1. Call list_namespaces and query Namespaces[? Name=='default'].CapacityRegion
  2. Returns the identity region directly — no error parsing needed
  3. Falls back to the old describe_user method if list_namespaces fails (e.g., missing permissions)

Backward Compatibility

The old behavior is preserved as a fallback. If list_namespaces raises any exception (permissions, throttling, etc.), the code falls back to the original describe_user + regex approach.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Replace the try/error approach that parses AccessDeniedException
messages with the list_namespaces API which returns CapacityRegion
directly. The old method relied on fragile regex matching of error
messages that could change without notice.

The describe_user fallback is preserved for environments where
list_namespaces permissions are not available.

Fixes aws-solutions-library-samples#943
@NithinChandranR-AWS

Copy link
Copy Markdown
Contributor Author

Hi, gentle nudge on this PR — it's been quiet for a while and is ready for review whenever you have bandwidth. Thanks!

This branch has not been deployed

No deployments
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.

Use api to get default region

1 participant