RobinBlomberg / kysely-codegen

Generate Kysely type definitions from your database.
MIT License
773 stars 69 forks source link

ERR_INVALID_URL when using IAM authentication token to connect to aurora postgres db #188

Open mjperrone opened 1 month ago

mjperrone commented 1 month ago

When I try to use kysely-codegen to connect to my postgres RDS instance in AWS Aurora and I set the DATABASE_URL to the connection string generated via this documented method, kysely-codegen --dialect postgres gives me the following error:

• Loaded environment variables from .env file.
• Using dialect 'postgres'.
node:internal/url:797
    this.#updateContext(bindingUrl.parse(input, base));

TypeError: Invalid URL
    at new URL (node:internal/url:797:36)
    at parse (/Users/mperrone/code/project/repo/node_modules/pg-connection-string/index.js:29:14)
    at new ConnectionParameters (/Users/mperrone/code/project/repo/node_modules/pg/lib/connection-parameters.js:56:42)
    at new Client (/Users/mperrone/code/project/repo/node_modules/pg/lib/client.js:18:33)
    at BoundPool.newClient (/Users/mperrone/code/project/repo/node_modules/pg-pool/index.js:218:20)
    at BoundPool.connect (/Users/mperrone/code/project/repo/node_modules/pg-pool/index.js:212:10)
    at PostgresDriver.acquireConnection (/Users/mperrone/code/project/repo/node_modules/kysely/dist/cjs/dialect/postgres/postgres-driver.js:21:41)
    at RuntimeDriver.acquireConnection (/Users/mperrone/code/project/repo/node_modules/kysely/dist/cjs/driver/runtime-driver.js:31:47)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async DefaultConnectionProvider.provideConnection (/Users/mperrone/code/project/repo/node_modules/kysely/dist/cjs/driver/default-connection-provider.js:10:28) {
  code: 'ERR_INVALID_URL',
  input: '<redacted>',
  base: 'postgres://base'
}

Is this type of connection string supported?

Upvote & Fund

Fund with Polar