3 months ago
Hello, I'm currently trying to use Bun + ElysiaJS (adding this context in case anyone else runs into this issue). I'm running into an interesting error:prepared statement ";.string.string" already exists
I actually reached out to the Bun team initially because I had assumed maybe it was a Bun issue.
https://github.com/oven-sh/bun/issues/17173
However, they've asked me whether or not I'm using transaction pooling or session pooling. I'm genuinely not sure what the default is set to for railway, and this is not a searchable setting on my database. What is the default for Railway's PostgreSQL db? Where can I find this in the future?
Also adding the nixpacks tag since it is the default for Railway's postgresql databases.
0 Replies
3 months ago
Afaik the default postgres service doesn't include any type of connection pooling functionality so that's maybe why it's failing since Bun may be not closing/opening connections properly? Or maybe it's related to Bun using prepared statements by default?
But I'm just guessing here and I would try to deploy a Pgbouncer in front of your postgres DB (https://railway.com/template/OpUzwe, it's very lightweight) together with the suggested config in the gh issue: prepare: false
I like this idea actually, and it might be the solution. I think what you mean to say (or maybe I misinterpreted) is: if I do use PgBouncer then I likely will not have to set prepare: false
. Because I can setup PgBouncer to do session pooling. Does that sound right to you?
3 months ago
Yep! But if it doesn't work with just PgBouncer you can also try adding that config
I'm going to try this and get back to you. If it works I'll add it to the github issue so other people can find this solution!
Looks like I'm back to not being able to connect to my database, after adding PgBouncer and restarting :/
https://discord.com/channels/713503345364697088/1365619106249838613
34386048:error:1e000065:Cipher functions:OPENSSL_internal:BAD_DECRYPT:..\..\third_party\boringssl\src\crypto\fipsmodule\cipher\e_[aes.c.inc:1065](aes.c.inc:1065):
3 months ago
Did u restart it or did u redeploy?
3 months ago
Do you have any data on it? Otherwise you can deploy a new one and point pgbouncer to it
3 months ago
Also make sure to follow the instructions at the bottom of the Pgbouncer template page
Yeah it unfortunately has nothing to do with PgBouncer. Last time I restarted my db it did this as well.
Hey again 😅, still can't access my database. Is this something that we can resolve?
3 months ago
Can you confirm that the pgbouncer and the bun queries are working as intended?
3 months ago
Sorry for not being of much help with this bug, never seen this issue tbh.
Adding PGBouncer didn't fix the issue :(. I am starting to believe it's a bun issue. I tried deploying with prepare: false
and now my project crashes.
https://github.com/oven-sh/bun/issues/17173#issuecomment-2847477067
3 months ago
You can also try explaining that you are just running postgres with ssl enabled since that's what Railway deploys
3 months ago
Hmm. Okay. Do you know the easiest way to update bun to latest without having to edit nixpacks configurations? If I have to run bun upgrade
somewhere where would I do that?
3 months ago
oh, you're using nixpacks?
3 months ago
what about 🌠 Railpack 🌠? https://railpack.com/languages/node/#bun
3 months ago
the new kid in town
Ohhhhh this has what I'm looking for too. You can set the version of bun in a variable
Hey thanks @Medim for your help, I think swapping to railpack is the solution for now. I also commented on the issue in case anyone else is running bun on railway.
3 months ago
Everything works fine now?
3 months ago
cool! Can I mark this thread as solved?
3 months ago
!s
Status changed to Solved medim • 3 months ago