feat: add AWS region selector to DynamoDB connection form - #593
Conversation
Driver plugins cannot inject fields into the generic host/port/username/ password connection form: the connection-modal.connection_content slot only replaces the whole form for no_connection_required drivers, and ConnectionParams had no region field to persist. Add an optional `region` to ConnectionParams (Rust + TS) and render a searchable AWS region select on the GENERAL tab when the active driver is DynamoDB. The field auto-fills from a standard dynamodb.<region>.amazonaws.com host when empty. Region codes match the AWS Regions commercial partition table (34 regions). Pairs with TabularisDB/tabularis-dynamodb-plugin#59, which already consumes `params.region` for SigV4 signing. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Thanks for tracking this down. This is a real problem and I want it fixed, my only doubt is about where the fix should live. This PR puts Your analysis of why the slot can't do it today is spot on, and those three points look like the better target:
With those in place the region select, the region list and the auto-fill from It's more work than what you have here, so no hard feelings if you'd rather not take it on. But if you do feel like tackling it, it would be a really valuable piece of work: it unblocks every plugin author who needs a custom connection field, not just DynamoDB, and it's the kind of groundwork that pays off for a long time. I'd be happy to review it in steps if that helps. Otherwise I can open a separate issue for the slot work and we figure out what to do with this PR in the meantime. Let me know which way you prefer. |
The host (TabularisDB/tabularis#593) is moving to an opaque extra: HashMap<String, String> on ConnectionParams instead of driver-specific core fields. Parse it here and use extra["region"] as the per-connection signing region when no explicit region param is present. Region precedence: explicit region param > extra["region"] > region parsed from an AWS endpoint hostname > plugin-level default-region setting > us-east-1. Profile connections remain exempt (they inherit their region from ~/.aws/config).
|
Thanks — you're right that the driver-specific field in core is the wrong place for this. Closing this PR and moving to the approach you outlined. The plugin side is already updated in tabularis-dynamodb-plugin#59: it now parses the opaque What remains on the core side — happy for this to become a separate issue, as you suggested:
|
* fix: use https and endpoint-derived region for AWS endpoints 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> * feat: add default-region selector to plugin settings 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> * feat: consume opaque extra connection fields for region The host (TabularisDB/tabularis#593) is moving to an opaque extra: HashMap<String, String> on ConnectionParams instead of driver-specific core fields. Parse it here and use extra["region"] as the per-connection signing region when no explicit region param is present. Region precedence: explicit region param > extra["region"] > region parsed from an AWS endpoint hostname > plugin-level default-region setting > us-east-1. Profile connections remain exempt (they inherit their region from ~/.aws/config). --------- Co-authored-by: Chris Chen <fuleinist@gmail.com> Co-authored-by: Cursor <cursoragent@cursor.com>
Summary
The DynamoDB plugin cannot put a region dropdown on the connection edit page by itself:
connection-modal.connection_contentonly replaces the whole form forno_connection_requireddriversConnectionParamshad noregionfield to persist or forward to the pluginWithout a region, the plugin falls back to
us-east-1signing for generic form connections, so real AWS endpoints in other regions fail withInvalidSignatureException(see TabularisDB/tabularis-dynamodb-plugin#59).Changes
regiontoConnectionParams(Rust + TypeScript)driver === "dynamodb"(orengine === "dynamodb")dynamodb.<region>.amazonaws.comhost when emptyTest plan
dynamodb.us-west-2.amazonaws.com— region auto-fills tous-west-2vitest run src/utils/awsRegions.test.tsMade with Cursor
Made with Cursor