Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sql: Silently swallows errors #2730

Open
TheDevMinerTV opened this issue May 11, 2024 · 4 comments
Open

sql: Silently swallows errors #2730

TheDevMinerTV opened this issue May 11, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@TheDevMinerTV
Copy link

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",
@TheDevMinerTV TheDevMinerTV added the bug Something isn't working label May 11, 2024
@TheDevMinerTV
Copy link
Author

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

@TheDevMinerTV TheDevMinerTV changed the title sql: Silently swallows connection errors sql: Silently swallows errors May 12, 2024
@tim-smart
Copy link
Member

I tried your example and got this error:

image

@TheDevMinerTV
Copy link
Author

Is there a environment variable to change the log level?

@mikearnaldi
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants