Skip to content

fix(drizzle-kit): normalize turso:// URLs and stop bundling @tursodatabase/serverless - #6169

Open
webdevsamran wants to merge 1 commit into
drizzle-team:betafrom
webdevsamran:fix/turso-url-normalization
Open

fix(drizzle-kit): normalize turso:// URLs and stop bundling @tursodatabase/serverless#6169
webdevsamran wants to merge 1 commit into
drizzle-team:betafrom
webdevsamran:fix/turso-url-normalization

Conversation

@webdevsamran

Copy link
Copy Markdown

Summary

Fixes #6164.

drizzle-kit detects the user-installed @tursodatabase/serverless via checkPackage(...) and logs "Using '@tursodatabase/serverless' driver", but the bundled CLI (dist/bin.cjs) actually ships with a pinned 1.1.3 copy of the package. Root cause: build.cli.ts marks driver packages as esbuild external so they resolve from the user's install at runtime — commit 481ccf1 added @tursodatabase/database, @sqlitecloud/drivers, and bun to that list but missed @tursodatabase/serverless. The static await import('@tursodatabase/serverless') inside the bundle therefore resolves to the bundled snapshot, and since 1.1.3 only normalizes libsql:// (not turso://), turso:// connection URLs fail even though the user's installed driver supports them.

Two complementary changes:

  1. build.cli.ts: add '@tursodatabase/serverless' to driversPackages so the user's installed version is used at runtime — matching the existing checkPackage intent.
  2. src/utils/utils-node.ts: translate turso://https:// in the libsql branch of normaliseSQLiteUrl. The libsql-family clients speak HTTPS to the same host, and doing this in the kit keeps behavior correct regardless of which driver copy ends up resolving.

Testing

New unit tests in drizzle-kit/tests/other/sqlite-url.test.ts:

  • turso://hosthttps://host (including query strings)
  • libsql://, file:, and bare paths unchanged
✓ tests/other/sqlite-url.test.ts (2 tests)
✓ tests/other/load-module.test.ts (1 test)

 Test Files  2 passed (2)
      Tests  3 passed (3)

…abase/serverless

drizzle-kit detects the user-installed @tursodatabase/serverless via checkPackage but, because the package was missing from the esbuild externals list, the bundled CLI shipped with a pinned 1.1.3 copy that lacks turso:// URL normalization - so turso:// connection URLs failed at runtime. Add @tursodatabase/serverless to driversPackages so the user's installed version is used, matching the checkPackage intent, and translate turso:// to https:// in normaliseSQLiteUrl for libsql-family drivers so older driver copies keep working.
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

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.

1 participant