Error with Effect Type Inference in RPC Client with Kysely and Postgres Integration

I'm struggling to use some of the apis together, I want to make a small rpc client that fetches data from database, I started with the example from the RPC demo and tried to adapt it to include postgres via kysely
import { createServer } from "node:http";
import { Layer, Effect } from "effect";
import { HttpRouter, HttpServer } from "@effect/platform";
import { NodeHttpServer, NodeRuntime } from "@effect/platform-node";
import { toHttpApp } from "@effect/rpc-http/HttpRpcRouter";
import { Rpc, RpcRouter } from "@effect/rpc";
import { PlaygroundList } from "./request";
import { PgLive, PgDB } from "./db";

export const appRouter = RpcRouter.make(
  Rpc.effect(PlaygroundList, () =>
    Effect.gen(function* () {
      const db = yield* PgDB;
      return yield* db.selectFrom("app_public.playgrounds").selectAll();
    }).pipe(Effect.mapError((e) => e.toString())),
  ),
);

const HttpLive = HttpRouter.empty.pipe(
  HttpRouter.post("/rpc", toHttpApp(appRouter)),
  HttpServer.serve(),
  HttpServer.withLogAddress,
  Layer.provide(PgLive),
  Layer.provide(NodeHttpServer.layer(createServer, { port: 3000 })),
);

NodeRuntime.runMain(Layer.launch(HttpLive));
but this gives
Argument of type 'Effect<never, ServeError, SqlClient>' is not assignable to parameter of type 'Effect<never, ServeError, never>'.
  Type 'SqlClient' is not assignable to type 'never'. [2769]
Was this page helpful?