Closed magnusrodseth closed 1 year ago
I assume the code throws here in connection-string-parser.ts
:
if (inferredDialectName !== 'sqlite') {
try {
void new URL(connectionString);
} catch {
throw new SyntaxError(`Invalid URL: '${connectionString}'`);
}
}
Good find. Perhaps void new URL(connectionString);
isn't a good enough check to see whether the connection string is valid. I'll look into it. Perhaps that check should be removed entirely, and we'll just let the connection fail if it's invalid.
@RobinBlomberg Would you be willing to remove it, so I could test it out ASAP? Alternatively, I could submit a PR if it would be just removing the lines highlighted above.
Getting the same error on using mysql, i assume that the env parsing doesnt properly work with certain passwords or usernames. It seems to work if there arent any special characters in the .env.
@RobinBlomberg Will there be created a new release after 0.9.0
that includes this fix?
@RobinBlomberg Will there be created a new release after
0.9.0
that includes this fix?
Of course! I will create a 0.9.1
soon (maybe today) as soon as I have the time.
I have a serverless TimescaleDB database running that I'm trying to autogenerate types from. Using the following config in my
lib/kysely.ts
, I successfully connect to the database:lib/kysely.ts
However, this
SensorData
is basically manually typed, and I want to usekysely-codegen
to do this for me.I use the following script, as I already have a MySQL database with Prisma pointing to
DATABASE_URL
:My environment variables are successfully loaded, as I get the following output in my terminal:
I think the problem that arises is the fact that by manually setting each property in
lib/kysely.ts
, I successfully connect to the database, but when passing the whole connection stringTIMESERIES_DB_CONNECTION_STRING
, this fails. My suspicion is further strengthened because the database connection previously failed when I tried to only use the connection string inlib/kysely.ts
.Why is
kysely-codegen
not able to connect to the PostgreSQL database with the connection string, whenkyself
itself is able to using an object as described above? How can we fix this?