depot / kysely-planetscale

A Kysely dialect for PlanetScale Serverless
https://depot.dev/blog/kysely-dialect-planetscale
MIT License
350 stars 15 forks source link

request failed, reason: connect ETIMEDOUT #16

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"

This is the database schema

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

Hey @jahirfiquitiva, you will want to open an issue for this at https://github.com/planetscale/database-js - this adapter just passes queries generated by Kysley there, but any connection or network issues would originate from the underlying serverless driver.

jahirfiquitiva commented 1 year ago

@jacobwgillespie I just had to create a new password https://twitter.com/kwuchu/status/1643914509801644032

it's working now, thanks!