kysely-org / kysely

A type-safe typescript SQL query builder
https://kysely.dev
MIT License
10.8k stars 275 forks source link

request failed, reason: connect ETIMEDOUT #415

Closed jahirfiquitiva closed 1 year ago

jahirfiquitiva commented 1 year ago

Hello ... I'm trying to use the library with a PlanetScale database ... but any request to it just fails with a ETIMEDOUT error

This is my configuration

import { Kysely } from 'kysely';
import { PlanetScaleDialect } from 'kysely-planetscale';

export type ReactionName = 'likes' | 'loves' | 'awards' | 'bookmarks';

export type CountersReactions = { [Key in ReactionName]?: number };

interface CountersTable extends CountersReactions {
  slug: string;
  views?: number;
}

interface Database {
  counters: CountersTable;
}

export const queryBuilder = new Kysely<Database>({
  dialect: new PlanetScaleDialect({
    url: process.env.DATABASE_URL,
  }),
});

and I'm trying to get the data like:

const slug = 'uses';
const data = await queryBuilder
      .selectFrom('counters')
      .where('slug', '=', slug)
      .select(['slug', 'likes', 'loves', 'awards', 'bookmarks'])
      .execute();

but the query never succeeds and it just shows the error: request to https://p9hawx83bcfm.us-west-2.psdb.cloud/psdb.v1alpha1.Database/Execute failed, reason: connect ETIMEDOUT 54.189.191.130:443"

jahirfiquitiva commented 1 year ago

This is the database schema

Shot 2023-04-05 at 21 57 14@2x
koskimas commented 1 year ago

This is not related to Kysely. The Dialect takes care of everything connection related, and in this case you're using a 3rd party dialect we have no control over.

This is most likely a configuration issue, but you may get help if you open this issue in PlanetScaleDialect's repo.

You could also try asking this in our Discord server where there are other PlanetScale users.