Effect-TS / effect

An ecosystem of tools to build robust applications in TypeScript

Home Page:https://effect.website

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

sql: Silently swallows errors

TheDevMinerTV opened this issue · comments

What version of Effect is running?

3.1.3

What steps can reproduce the bug?

  1. Set up a PostgreSQL container
  2. Run the following code (make sure that the connection credentials are incorrect)
import * as Sql from "@effect/sql";
import * as Pg from "@effect/sql-pg";
import { Config, Effect } from "effect";

const SqlLive = Pg.client.layer({ database: Config.succeed("inventory") });

const program = Effect.gen(function* () {
  yield* Effect.log("Connecting to SQL...");
  const sql = yield* Sql.client.Client;
  yield* Effect.log("Connected to SQL!");

  const people = yield* sql<{
    readonly id: number;
    readonly name: string;
  }>`SELECT id, name FROM people`;
  // Hangs here ^

  yield* Effect.log(`Got ${people.length} results!`);
}).pipe(Effect.scoped);

program.pipe(Effect.provide(SqlLive), Effect.runPromise);

What is the expected behavior?

The error gets logged, or gets returned up.

What do you see instead?

Nothing from the Effect code, but my PostgreSQL server is spitting out authentication errors.

Additional information

    "@effect/sql": "^0.2.5",
    "@effect/sql-pg": "^0.2.5",

Apparently it's also happening with the migrator which also silently hangs the application when the migrations folder doesn't exist.

commented

I tried your example and got this error:

image

Is there a environment variable to change the log level?

@TheDevMinerTV is this related to the discord discussion? if yes then this is not an issue, if not we need a full repro