Skip to content

feat: add AWS region selector to DynamoDB connection form - #593

Closed
fuleinist wants to merge 1 commit into
TabularisDB:mainfrom
fuleinist:feat/connection-region-field
Closed

feat: add AWS region selector to DynamoDB connection form#593
fuleinist wants to merge 1 commit into
TabularisDB:mainfrom
fuleinist:feat/connection-region-field

Conversation

@fuleinist

Copy link
Copy Markdown
Contributor

Summary

The DynamoDB plugin cannot put a region dropdown on the connection edit page by itself:

  • connection-modal.connection_content only replaces the whole form for no_connection_required drivers
  • slot context has no setters for host/port/region
  • ConnectionParams had no region field to persist or forward to the plugin

Without a region, the plugin falls back to us-east-1 signing for generic form connections, so real AWS endpoints in other regions fail with InvalidSignatureException (see TabularisDB/tabularis-dynamodb-plugin#59).

Changes

  • Add optional region to ConnectionParams (Rust + TypeScript)
  • Render a searchable AWS Region select on the GENERAL tab when driver === "dynamodb" (or engine === "dynamodb")
  • Auto-fill region from dynamodb.<region>.amazonaws.com host when empty
  • Region list: 34 commercial AWS regions per the AWS Regions docs
  • Unit tests for region parsing / list length

Test plan

  • Open/edit a DynamoDB connection — GENERAL tab shows AWS Region select after Host/Port
  • Enter host dynamodb.us-west-2.amazonaws.com — region auto-fills to us-west-2
  • Manually pick a different region — host change does not overwrite it
  • Save + Test Connection against a real AWS account in that region
  • MySQL/Postgres connections — no region field shown
  • vitest run src/utils/awsRegions.test.ts

Made with Cursor

Made with Cursor

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>
@debba

debba commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

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 driver === "dynamodb" and a list of 34 AWS regions inside the core app. It works, but it means every time a plugin needs one extra connection field we add another branch to NewConnectionModal and another column to ConnectionParams. I know we already did exactly that for the SQL Server Encrypt dropdown in #236, so it's a pattern I helped create, but I'd like to stop growing it.

Your analysis of why the slot can't do it today is spot on, and those three points look like the better target:

  1. hasConnectionContentSlot is gated on noConnectionRequired, so the slot only renders for drivers with no form at all, and it replaces the form instead of extending it. We could either drop that gate and keep a second anchor, or add a connection-modal.extra_fields slot rendered right after host/port for any driver.
  2. The slot context only carries driver, database, onDatabaseChange and connectionName. Adding the setters there is cheap.
  3. Instead of a dedicated region, an opaque extra: HashMap<String, String> on ConnectionParams, persisted and forwarded to the driver untouched, so the core never needs to know what a plugin stores in it.

With those in place the region select, the region list and the auto-fill from dynamodb.<region>.amazonaws.com all live in tabularis-dynamodb-plugin, and the next plugin that needs an API key or an account id gets it for free.

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.

fuleinist added a commit to fuleinist/tabularis-dynamodb-plugin-1 that referenced this pull request Aug 3, 2026
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).
@fuleinist

Copy link
Copy Markdown
Contributor Author

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 extra: HashMap<String, String> on ConnectionParams and uses extra["region"] as the per-connection signing region (precedence: explicit region param → extra["region"] → hostname-parsed region → plugin default-region setting → us-east-1). So the plugin will honour a connection-form region selector the moment the host forwards it, with no further core coupling.

What remains on the core side — happy for this to become a separate issue, as you suggested:

  1. Opaque extra: HashMap<String, String> on ConnectionParams (Rust + TS), persisted and forwarded to drivers untouched
  2. A connection-modal.extra_fields slot rendered after host/port for any driver (or dropping the noConnectionRequired gate on hasConnectionContentSlot), plus the setters in the slot context
  3. The DynamoDB region select, the 34-region list, and the dynamodb.<region>.amazonaws.com auto-fill then live in the plugin

@fuleinist fuleinist closed this Aug 3, 2026
fuleinist added a commit to TabularisDB/tabularis-dynamodb-plugin that referenced this pull request Aug 6, 2026
* 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>
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.

2 participants