R
Railway15mo ago
Michael

deploy prisma/client not found

hey, when I deploy the prisma client in node_modules is not found because its not generating, I have added a postinstall startup script with prisma generate command but this is not triggering after the install for some reason, does someone know why? I am also using bun 1.0
48 Replies
Percy
Percy15mo ago
Project ID: 3bb8b6a8-40e5-4cef-b8d2-3c491bb9e5e3
Michael
MichaelOP15mo ago
3bb8b6a8-40e5-4cef-b8d2-3c491bb9e5e3 i tried it out locally and it worked after bun install it triggered the postinstall and ran prisma generate
fedev
fedev15mo ago
have you tried adding npx prisma generate in the build command? (even though prisma should auto generate it after installing it) (sorry bunx not npx if you're using bun)
Michael
MichaelOP15mo ago
yes but it doesnt seem to trigger
fedev
fedev15mo ago
Can you share your package json and error logs?
Michael
MichaelOP15mo ago
here is my package.json
{
"name": "fairely",
"version": "0.0.1",
"private": true,
"scripts": {
"dev": "vite dev",
"build": "prisma generate && vite build",
"preview": "vite preview",
"start": "bun --bun run ./build/index.js"
},
"prisma": {
"seed": "bun run ./prisma/seed.js"
},
"devDependencies": {
"@sveltejs/adapter-auto": "^2.0.0",
"@sveltejs/kit": "^1.20.4",
"autoprefixer": "^10.4.15",
"postcss": "^8.4.29",
"prisma": "^5.2.0",
"svelte": "^4.0.5",
"svelte-adapter-bun": "^0.5.0",
"tailwindcss": "^3.3.3",
"vite": "^4.4.2"
},
"type": "module",
"dependencies": {
"@prisma/client": "5.2.0",
"@tailwindcss/forms": "^0.5.6"
}
}
{
"name": "fairely",
"version": "0.0.1",
"private": true,
"scripts": {
"dev": "vite dev",
"build": "prisma generate && vite build",
"preview": "vite preview",
"start": "bun --bun run ./build/index.js"
},
"prisma": {
"seed": "bun run ./prisma/seed.js"
},
"devDependencies": {
"@sveltejs/adapter-auto": "^2.0.0",
"@sveltejs/kit": "^1.20.4",
"autoprefixer": "^10.4.15",
"postcss": "^8.4.29",
"prisma": "^5.2.0",
"svelte": "^4.0.5",
"svelte-adapter-bun": "^0.5.0",
"tailwindcss": "^3.3.3",
"vite": "^4.4.2"
},
"type": "module",
"dependencies": {
"@prisma/client": "5.2.0",
"@tailwindcss/forms": "^0.5.6"
}
}
#10 0.938 + [email protected]

#10 0.938 + [email protected]

#10 0.938 + [email protected]

#10 0.938 + [email protected]

#10 0.938 + [email protected]

#10 0.938 + @prisma/[email protected]

#10 0.938 + @tailwindcss/[email protected]





#10 0.938

#10 0.938 145 packages installed [638.00ms]

#10 DONE 1.1s





#11 [stage-0 7/10] COPY . /app/.

#11 DONE 0.0s



#12 [stage-0 8/10] RUN --mount=type=cache,id=s/e19bc981-d4b3-4d83-95f8-894c7442cd72-node_modules/cache,target=/app/node_modules/.cache bun --bun run build



#12 0.318 $ prisma generate && vite build



#12 2.765



#12 2.765 vite v4.4.9 building SSR bundle for production...

#12 2.817 transforming...



#12 2.950 12:33:33 PM [vite-plugin-svelte] /app/src/routes/login/+page.svelte:81:9 A11y: '#' is not a valid href attribute

#12 2.950 79: <div class="text-sm leading-6">

#12 2.950 80: <a

#12 2.950 81: href="#"

#12 2.950 ^

#12 2.950 82: class="font-semibold text-violet-600 hover:text-violet-500">Forgot password?</a

#12 2.950 83: >



#12 4.686 ✓ 78 modules transformed.



#12 4.825 rendering chunks...



#12 5.412 error:

#12 5.412

#12 5.412 error: Cannot find module ".prisma/client/index" from "/app/node_modules/@prisma/client/index.js"

#12 5.412


#10 0.938 + [email protected]

#10 0.938 + [email protected]

#10 0.938 + [email protected]

#10 0.938 + [email protected]

#10 0.938 + [email protected]

#10 0.938 + @prisma/[email protected]

#10 0.938 + @tailwindcss/[email protected]





#10 0.938

#10 0.938 145 packages installed [638.00ms]

#10 DONE 1.1s





#11 [stage-0 7/10] COPY . /app/.

#11 DONE 0.0s



#12 [stage-0 8/10] RUN --mount=type=cache,id=s/e19bc981-d4b3-4d83-95f8-894c7442cd72-node_modules/cache,target=/app/node_modules/.cache bun --bun run build



#12 0.318 $ prisma generate && vite build



#12 2.765



#12 2.765 vite v4.4.9 building SSR bundle for production...

#12 2.817 transforming...



#12 2.950 12:33:33 PM [vite-plugin-svelte] /app/src/routes/login/+page.svelte:81:9 A11y: '#' is not a valid href attribute

#12 2.950 79: <div class="text-sm leading-6">

#12 2.950 80: <a

#12 2.950 81: href="#"

#12 2.950 ^

#12 2.950 82: class="font-semibold text-violet-600 hover:text-violet-500">Forgot password?</a

#12 2.950 83: >



#12 4.686 ✓ 78 modules transformed.



#12 4.825 rendering chunks...



#12 5.412 error:

#12 5.412

#12 5.412 error: Cannot find module ".prisma/client/index" from "/app/node_modules/@prisma/client/index.js"

#12 5.412


build logs ^ is running prisma generate but somehow just skipping it then sorry for the late reply
fedev
fedev15mo ago
I tired everything and i get the same error, I think it's a bun error
Michael
MichaelOP15mo ago
hmm ok but it works locally
fedev
fedev15mo ago
for me running locally bun x prisma generate doesen't do anything
Michael
MichaelOP15mo ago
bunx prisma generate works locally for me
fedev
fedev15mo ago
are you on linux/max or WSL?
Michael
MichaelOP15mo ago
mac
fedev
fedev15mo ago
oh, then bunx doesen't work for me because of wsl guess we'll wait for brody to check this
Michael
MichaelOP15mo ago
okay
fedev
fedev15mo ago
From bun discord server it seems like to run prisma and bun you also need nodejs, which I don't think railway is using with bun (i'm not sure) @vergeilt
No description
Brody
Brody15mo ago
Michael, do you have a nixpacks.toml
ThallesComH
ThallesComH15mo ago
try to run the prisma generate at runtime "start": "prisma generate && bun --bun run ./build/index.js"
Michael
MichaelOP15mo ago
i do have a nixpacks.toml
fedev
fedev15mo ago
I have tried that too, it seems like prisma just doesen't do anything with prisma generate
Brody
Brody15mo ago
send it please
Michael
MichaelOP15mo ago
[phases.setup]
nixpkgsArchive = 'c054b2a07bce2be3b85fed85f45aea6a4b97f5cc'
[phases.setup]
nixpkgsArchive = 'c054b2a07bce2be3b85fed85f45aea6a4b97f5cc'
Brody
Brody15mo ago
[phases.setup]
nixpkgsArchive = 'c054b2a07bce2be3b85fed85f45aea6a4b97f5cc'
nixPkgs = ['...', 'nodejs_18']
[phases.setup]
nixpkgsArchive = 'c054b2a07bce2be3b85fed85f45aea6a4b97f5cc'
nixPkgs = ['...', 'nodejs_18']
try that, then run the prisma generate thingy with node instead
fedev
fedev15mo ago
Worked for me 9001checkmarkoutline
Brody
Brody15mo ago
yay
fedev
fedev15mo ago
Brody the best PepeKing
Michael
MichaelOP15mo ago
thank you! Brody i will donate to you thanks for your work
Brody
Brody15mo ago
you really don't have to, but thank you
Spacemandev
Spacemandev15mo ago
running into the same problem, added nixPkgs line in nixpacks.toml and getting this:
No description
Medim
Medim15mo ago
try adding libssl-dev to aptPkgs
[phases.setup]
nixpkgsArchive = 'c054b2a07bce2be3b85fed85f45aea6a4b97f5cc'
nixPkgs = ['...', 'nodejs_18']
aptPkgs = ['...', 'libssl-dev']
[phases.setup]
nixpkgsArchive = 'c054b2a07bce2be3b85fed85f45aea6a4b97f5cc'
nixPkgs = ['...', 'nodejs_18']
aptPkgs = ['...', 'libssl-dev']
Spacemandev
Spacemandev15mo ago
still same error
No description
Spacemandev
Spacemandev15mo ago
[phases.setup]
nixPkgs = ['...', 'nodejs_18']
aptPkgs = ['...', 'libssl-dev']
[phases.setup]
nixPkgs = ['...', 'nodejs_18']
aptPkgs = ['...', 'libssl-dev']
Michael
MichaelOP15mo ago
i tried this with the setup brody said and its still not really working its not running prisma generate for some reason im running npx prisma generate in my start script now or how would you do it
Brody
Brody15mo ago
I'd run it in a prisma build phase https://nixpacks.com/docs/configuration/file#phases
Michael
MichaelOP15mo ago
nhm ok so for some reason it is not working still though
#12 0.597 $ vite build && bun x prisma generate



#12 1.545

#12 1.545 vite v4.4.9 building SSR bundle for production...

#12 1.632 transforming...



#12 1.854 7:06:15 PM [vite-plugin-svelte] /app/src/routes/login/+page.svelte:81:9 A11y: '#' is not a valid href attribute

#12 1.854 79: <div class="text-sm leading-6">

#12 1.854 80: <a

#12 1.854 81: href="#"

#12 1.854 ^

#12 1.854 82: class="font-semibold text-violet-600 hover:text-violet-500">Forgot password?</a

#12 1.854 83: >



#12 4.149 ✓ 81 modules transformed.



#12 4.295 rendering chunks...



#12 5.003 error:

#12 5.003

#12 5.003 error: Cannot find module ".prisma/client/index" from "/app/node_modules/@prisma/client/index.js"

#12 5.003
#12 0.597 $ vite build && bun x prisma generate



#12 1.545

#12 1.545 vite v4.4.9 building SSR bundle for production...

#12 1.632 transforming...



#12 1.854 7:06:15 PM [vite-plugin-svelte] /app/src/routes/login/+page.svelte:81:9 A11y: '#' is not a valid href attribute

#12 1.854 79: <div class="text-sm leading-6">

#12 1.854 80: <a

#12 1.854 81: href="#"

#12 1.854 ^

#12 1.854 82: class="font-semibold text-violet-600 hover:text-violet-500">Forgot password?</a

#12 1.854 83: >



#12 4.149 ✓ 81 modules transformed.



#12 4.295 rendering chunks...



#12 5.003 error:

#12 5.003

#12 5.003 error: Cannot find module ".prisma/client/index" from "/app/node_modules/@prisma/client/index.js"

#12 5.003
its like doing nothing im also not sure why its running bun x prisma generate when my build script looks like this
"build": "vite build && npx prisma generate",
"build": "vite build && npx prisma generate",
Brody
Brody15mo ago
do you have a build script set somewhere else? like in the service settings, a nixpacks.toml, a railway.json, etc
Michael
MichaelOP15mo ago
nope is it maybe becuase i use bun --bun run build ? but without the --bun its also running bun x prisma generate
Brody
Brody15mo ago
railway won't change your build command, you likely have it set somewhere else
Michael
MichaelOP15mo ago
but when i locally run bun run build it works i dont have a railway.json only this
[phases.setup]
nixpkgsArchive = 'c054b2a07bce2be3b85fed85f45aea6a4b97f5cc'
nixPkgs = ['...', 'nodejs_18']
[phases.setup]
nixpkgsArchive = 'c054b2a07bce2be3b85fed85f45aea6a4b97f5cc'
nixPkgs = ['...', 'nodejs_18']
in my nixpacks.toml
Brody
Brody15mo ago
my recommendation would be to stick with node unless you know that bun will give you a measurable performance gain what is your start command anyway
Michael
MichaelOP15mo ago
yeah i mean its not just the performance i love bun with all the stuff integrated already i use some functions of it such as the password hashing i think i got it working on railway now im now doing
"build": "npx prisma generate && vite build"
"build": "npx prisma generate && vite build"
the prisma generate before the build which makes sense tbh but locally it didnt matter somehow
Brody
Brody15mo ago
^
Michael
MichaelOP15mo ago
bun run start and then
"start": "bun --bun run ./build/index.js"
"start": "bun --bun run ./build/index.js"
oh im having the same error now as the other guy
Prisma cannot find the required `libssl` system library in your system. Please install openssl-3.0.x and try again.

Details: libssl.so.3: cannot open shared object file: No such file or directory
Prisma cannot find the required `libssl` system library in your system. Please install openssl-3.0.x and try again.

Details: libssl.so.3: cannot open shared object file: No such file or directory
Michael
MichaelOP15mo ago
this doesnt seem to change anything
Brody
Brody15mo ago
aptPkgs = ['...', 'libssl-dev', 'libssl3']
aptPkgs = ['...', 'libssl-dev', 'libssl3']
Michael
MichaelOP15mo ago
still the same error
PrismaClientInitializationError: Unable to require(`/app/node_modules/.prisma/client/libquery_engine-debian-openssl-3.0.x.so.node`).

Prisma cannot find the required `libssl` system library in your system. Please install openssl-3.0.x and try again.

Details: libssl.so.3: cannot open shared object file: No such file or director
PrismaClientInitializationError: Unable to require(`/app/node_modules/.prisma/client/libquery_engine-debian-openssl-3.0.x.so.node`).

Prisma cannot find the required `libssl` system library in your system. Please install openssl-3.0.x and try again.

Details: libssl.so.3: cannot open shared object file: No such file or director
Brody
Brody15mo ago
I'm out of ideas besides build with a dockerfile
Ray
Ray15mo ago
Try removing your nixpacks.toml With your nixpkgsArchive you're sticking it to a old archive version (pre-Bun support), it's no longer needed since that was upstreamed and contains latest Bun With how you're defining providers, looks like you'd have both bun and node together There's possibly some conflict between node/bun on libssl
Want results from more Discord servers?
Add your server