fix: AWS endpoint scheme/region + default-region selector - #59
Open
fuleinist wants to merge 2 commits into
Open
Conversation
Connecting to a real AWS DynamoDB endpoint via the generic GUI form (host/port/username/password) failed two ways in normalized_params: 1. Scheme: host+port always became http://host:port, so port 443 produced http://dynamodb.us-west-2.amazonaws.com:443 — plain HTTP to a TLS-only port, failing at the transport level. HTTPS is now used when the port is 443 or the host ends with .amazonaws.com. 2. Region: with no region field in the form, the signing region defaulted to us-east-1 regardless of the endpoint, so AWS rejected every request with InvalidSignatureException. The region is now parsed from the endpoint hostname (dynamodb.<region>.amazonaws.com), falling back to us-east-1 only for non-AWS endpoints (e.g. DynamoDB Local). Verified live against a real AWS account: test_connection succeeds and get_tables returns 400 tables in ~6.5s using only the generic form fields. Co-authored-by: Cursor <cursoragent@cursor.com>
The generic GUI connection form has no region field, and a per-connection
region selector is not possible from a driver plugin today: the
connection-modal.connection_content slot only receives {driver, database,
onDatabaseChange, connectionName} and only renders for
no_connection_required drivers.
Instead declare a plugin-level "Default AWS region" select setting in
.tabularium (all 34 current AWS regions per the AWS Regions docs). The
host renders it under Settings -> Plugins -> DynamoDB and delivers the
saved value via the initialize RPC, which the plugin now stores.
Region resolution order in normalized_params:
1. explicit `region` param
2. region parsed from an AWS endpoint hostname
3. plugin-level default-region setting
4. us-east-1
The settings cell is process-global; tests share a lock to avoid races.
Co-authored-by: Cursor <cursoragent@cursor.com>
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.
Summary
Connecting to a real AWS DynamoDB endpoint via the generic GUI connection form (host / port / username / password) was broken in
normalized_params— only DynamoDB Local worked. This PR fixes the transport/signing bugs and adds a region selector.1. Wrong scheme —
http://host:443host+portalways becamehttp://host:port. Withhost=dynamodb.us-west-2.amazonaws.com,port=443the plugin dialed plain HTTP to a TLS-only port → transport-level dispatch failure.Fix: HTTPS when
port == 443or host ends with.amazonaws.com.2. Wrong signing region — hardcoded
us-east-1The generic form has no region field, so the signing region defaulted to
us-east-1regardless of the endpoint. SigV4 signed for the wrong region → AWS rejects every request withInvalidSignatureException.Fix: parse the region from the endpoint hostname (
dynamodb.us-west-2.amazonaws.com→us-west-2).3. Region selector (new)
A per-connection region dropdown in the connection edit page is not possible from a driver plugin today: the
connection-modal.connection_contentslot only receives{driver, database, onDatabaseChange, connectionName}and only renders forno_connection_requireddrivers. (App-side follow-up: extend the slot context with form state, or add a driver-declared connection-fields mechanism.)Instead this PR declares a plugin-level "Default AWS region" select in
.tabularium(all 34 current regions per the AWS Regions doc). The host renders it under Settings → Plugins → DynamoDB and delivers the saved value via theinitializeRPC, which the plugin now stores (previously ignored).Region resolution order:
regionparamus-east-1Changes
normalized_params: scheme selection +region_from_endpointhelper + settings fallbacksettingsmodule: storesinitializesettings (process-global).tabularium:settingsarray with the region selectTest plan
cargo test— 185 passed (8 new)cargo clippy/cargo fmt— cleanhost/port/username/passwordonly):test_connection→{"success": true}(previously failed)get_tables→ 400 tables in ~6.5s with full metadataexecute_query→ rows + completepaginationobjectNo credentials, endpoints, or account-specific data included in this change.
Made with Cursor