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

Bun+Prisma+CockroachDB exits without output #8629

Open
TimMensch opened this issue Feb 2, 2024 · 4 comments
Open

Bun+Prisma+CockroachDB exits without output #8629

TimMensch opened this issue Feb 2, 2024 · 4 comments
Labels
bug Something isn't working needs investigate Needs to be investigated to find the root cause

Comments

@TimMensch
Copy link

TimMensch commented Feb 2, 2024

What version of Bun is running?

1.0.25+a8ff7be64

What platform is your computer?

Linux 5.15.0-91-generic x86_64 x86_64

What steps can reproduce the bug?

Follow this guide:

https://bun.sh/guides/ecosystem/prisma

With the following exceptions:

  1. Create a .env file with DATABASE_URL= that points to a CockroachDB database. You can get that info by signing up at https://www.cockroachlabs.com/ for a free account and creating a free database.
  2. Instead of bunx prisma init --datasource-provider sqlite, do bunx prisma init --datasource-provider cockroachdb
  3. Run the code.
  4. Observe that it crashes out with no error message

What is the expected behavior?

The code works?

What do you see instead?

Nothing. It crashes the console app entirely. Exit code 0. No notification of a crash. "try/catch" ignores the problem. It just hard crashes.

Additional information

I tried adding this code to the sample:

    try {
        await prisma.$connect();
        console.log("Connected to the database");
    } catch (e) {
        console.error("Error connecting to the database:", e);
    }

It crashes immediately on the call to $connect. Neither message prints.

I tried:

process.on("unhandledRejection", (reason, promise) => {
    console.error("Unhandled Rejection at:", promise, "reason:", reason);
    process.exit(1);
});

...to see if that was happening. Nope. It still crashes out.

I tested on a completely clean install, following the tutorial I linked above. I looked on Discord and found an old unsolved error from months ago that looks very similar.

Thoughts? I was really enthusiastic about Bun, but hitting a brick wall on the second day of development isn't inspiring confidence. And it's particularly vexing that Bun explicitly claims to work with Prisma.io, which it clearly doesn't for at least two of the database adapters.

This bug looks related:

#3647

...only now it crashes cleanly without the segfault.

@TimMensch TimMensch added the bug Something isn't working label Feb 2, 2024
@Electroid Electroid added the needs investigate Needs to be investigated to find the root cause label Feb 2, 2024
@Electroid Electroid changed the title Bun+Prisma+CockroachDB hard & silent crash Bun+Prisma+CockroachDB exits without output Feb 2, 2024
@Electroid

This comment was marked as outdated.

@Electroid
Copy link
Contributor

It looks like a Linux-specific issue.

@TimMensch
Copy link
Author

@Electroid Linux-specific? Possibly, but...isn't Bun supposed to support Linux as a first-class environment?

@vladimir-gal
Copy link

vladimir-gal commented Feb 21, 2024

Encountered the same issue on macOS, seems like it might be a UNIX-related problem.

Tested with Bun 1.0.28, macOS Sonoma on Intel processor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs investigate Needs to be investigated to find the root cause
Projects
None yet
Development

No branches or pull requests

3 participants