OpenSSL error when using Bun + Prisma
Getting an error when using Bun and prisma together. Prisma requires node to work, so start command is
npx prisma generate && bun run src/server.ts
Also my nixpacks.toml has nodejs_18 in it via
40 Replies
Project ID:
66d1dae6-5074-4f50-8a3b-03d95403b988
66d1dae6-5074-4f50-8a3b-03d95403b988
https://discord.com/channels/713503345364697088/1150374587658403961/1153088907349606460
looks like this might be a problem with node / bun having conflicts on libssl
does prisma not work with bun yet?
bunx prisma generate
it does not (atleast on railway)
does that work locally?
yes works locally
then ditch the npm lock file and npm command and just use bun for the lot of it. you'll have less issues
i removed the node requirements and instead generated the client locally and pushed it (generating debian binary target for railway as required)
still getting libssl not found.
i have the same problem
Possibly related https://github.com/oven-sh/bun/issues/3827
GitHub
Prisma generate doens't work in Docker ยท Issue #3827 ยท oven-sh/bun
What version of Bun is running? 0.7 What platform is your computer? Darwin 22.5.0 arm64 arm What steps can reproduce the bug? prisma generate appears to do nothing when run with bunx in docker. It ...
This is odd, I don't think that's running an ARM image...
Does it work if you remove binaryTargets?
no it specifically tells me to add debian as a binary target if i remove it
when you build prisma, it compiles, i got around building it in the cloud by not needing node and then just building it locally and then pushing
but doing that required me to build both for native (my macbook so i can use it locally) and debian for the railway image
then i pushed the compiled build into my repo hoping i could just use bun instead of "npx prisma generate && bun run..." because that comamnd was giving an libssl error
which previously in the other thread had been mentioned as potentially coming from a mix of node/bun
If you're open to trying this out:
nixpacks.toml:
+ change start script to
bunx prisma generate && bun run src/server.ts
i had that before (see other thread), and it gave the SSL error
https://discord.com/channels/713503345364697088/1150374587658403961/1152804112153444392
yikes
what's your Prisma version?
5.3 i believe
5.3.1* to be exact
I'll try to poke into this when time permits, sounds like an upstream issue though the jury's out on whether it's Bun/Prisma - but will keep you posted!
thank you!
Hey gang! Having this very same issue. Prisma will look in
/usr/lib64
and /lib64
for libssl
. However, there is no libssl
there, even though you've installed it.
Running openssl version -e
in the container returns:
So I just think there's a missing symlink or $LD_LIBRARY_PATH
missing somewhere. I don't have any experience with NixOS or Nixpacks, so would love some help here. ๐
That's where they exist RN. Will try to symlink. ๐
I got it up and running: ๐ Both with prisma generate
and starting the server. This is my nixpacks.toml
:
I'm not sure if this is a good idea, but it works. ๐
Explanation:
- Prisma will look in /lib
for libssl.so.3
and libcrypto.so.3
, so we symlink them there.
- It needs to be /lib
since prisma will use $LD_LIBRARY_PATH
when searching, and only /lib
is included by default
- You can run prisma generate
by including nodejs
in your container (you can remove it after running it)
- Also: OpenSSL is already included in the container by default (no need to add it!)
I have also tried using nixLibs = ['...', 'openssl']
in both [start]
and [phases.build]
. But I get super weird errors.
I believe this is a better solution, for sure, if it would work.So to be exact node being used to generate prisma and then bun to run the files
Exactly. Then symlink the .so/.3-files to make the prisma driver work.
What are the errors that you get? I was able to do this no problem
Interesting! Under which section did you put the
nixLibs
? ๐setup
I'll give it a go! ๐
Wat:
failed to create symbolic link '/etc/resolv.conf': Device or resource busy
๐Link to build logs?
Sure, started a new build here! https://railway.app/project/0d9ba7a2-2d72-4e02-a96b-e5726d664511/service/cca92c47-1cdc-4c74-a92e-fbf4f393b021?id=26890294-0c26-4750-8780-9a9846748fa7
Railway
404 - Page not found
Railway is an infrastructure platform where you can provision infrastructure, develop with that infrastructure locally, and then deploy to the cloud.
Funky, huh? If you cannot see the nixpacks.toml, this is it:
ya very strange. I am not able to reproduce using latest nixpacks version. I have this nixpacks.toml
Nixpacks will include nodejs when bun is found now. And the openssl lib will be added
I am able to prisma generate no problem
What happens if you add the
nixLibs
part? ๐it is added by default now
I don't see any errors
Oh! OK. ๐
Let me try entirely w/o it then.
you shouldn't need any of the node stuff either
There's soon going to be nothing left of my nixpacks.toml at this rate.
Did you push some new stuff, or have I been hallucinating all these errors from before? ๐ซ ๐
It works great now, either way. Thanks for all the help! ๐
I pushed a glibc fix and we now better handle Bun with node. Glad it is working now ๐
Hehey! ๐ Awesome work, jr, thanks a lot! ๐
oh railway uses toml files for configuration?
I haven't used railway yet, I'm thinking of using it in the future but I've to make sure that I can use bun and node in the same environment at the same time, seems like you got that working
Though I've opened an issue on the Prisma side to have a look into it incase it's an "issue" on their end being dependant on node
Indeed, it uses nixpacks. It supports JSON too, though!
Basically the configuration specifies what to include in your container, and how to build your app.
oh I see, can we use images as well to specify this? I got this from the community that had similar issue
Yes you can just use a Dockerfile if you would like