Giter Site home page Giter Site logo

Comments (21)

thomas779 avatar thomas779 commented on June 30, 2024 2

Bumping this as I'm getting the exact issue to @Maxim-Filimonov. Everything works locally, but deploying to railway is a journey of painful debugging.

@coffee-cup if you need some hard evidence, I would suggest running through these steps:

  1. fork this repo: https://github.com/amorriscode/elysia-starter
  2. "prisma": "5.7.1" and "@prisma/client": "5.7.1" (versions shouldn't matter, but some devs reported having it fixed downgrading or upgrading... error was replicated with v5.3.x and v5.7.x on my side).
  3. cp this schema.prisma:

What's your Prisma schema set-up Maxim ?
This is mine:

datasource db {
    provider = "postgresql"
    url      = env("DATABASE_URL")
}

generator client {
    provider      = "prisma-client-js"
    output        = "./generated/client"
    binaryTargets = ["native", "linux-musl", "debian-openssl-3.0.x"]
}

nixpacks.toml:

[phases.setup]
nixPkgs = ['bun']

[phases.install]
cmds = ['bun install']

[phases.build]
cmds = ['bunx prisma generate', 
        'bunx prisma migrate deploy', 
        'bun build --target=bun ./src/index.ts --outdir ./build']

[start]
cmd = 'bun run src/index.ts'

Error:

PrismaClientInitializationError: Unable to require(`/app/prisma/generated/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 directory

Tried to add 'openssl_3_0_x to my nixPkgs = ['bun', 'openssl_3_0_x'] but that didn't work.

Also, changing start cmd from bun run src/index.ts to bun run build/indexjs will produce error:

Server is running at localhost:5000
1 | __dirname
^
ReferenceError: Can't find variable: __dirname
at /app/build/index.js:1604:69
at processTicksAndRejections (:61:76)

from nixpacks.

imadbz avatar imadbz commented on June 30, 2024 1

+1 couldn't get it to work either

from nixpacks.

Maxim-Filimonov avatar Maxim-Filimonov commented on June 30, 2024 1

My fix was to migrate to fly.io :|

from nixpacks.

Maxim-Filimonov avatar Maxim-Filimonov commented on June 30, 2024 1

@iloveitaly where to add --libs openssl ?

from nixpacks.

baptisteArno avatar baptisteArno commented on June 30, 2024 1

@iloveitaly Nah, I that's not it... I think nixpacks even detected that it needs openssl by default for my project.

Still, I tried to specifically tell it to add the openssl lib with the env NIXPACKS_PKGS=openssl

╔═══════════════ Nixpacks v1.20.0 ══════════════╗
║ setup │ openssl, nodejs_18, bun, openssl ║
║───────────────────────────────────────────────║
║ install │ bun install ║
║───────────────────────────────────────────────║
║ build │ bun build:chat-api ║
║───────────────────────────────────────────────║
║ start │ bun start:chat-api ║
╚═══════════════════════════════════════════════╝

The problem happens at runtime, on the docker when the app is running, on Prisma init, it says:

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 directory

at new e (/app/node_modules/@prisma/client/runtime/library.js:26:1871)

from nixpacks.

github-actions avatar github-actions commented on June 30, 2024

Hello, @Maxim-Filimonov! Thanks for your submission.

Our team will respond soon. If you need more immediate help, try our Forum or our Discord. Thanks!

from nixpacks.

coffee-cup avatar coffee-cup commented on June 30, 2024

We have an example that builds and runs no problem using Prisma 5 and bun https://github.com/railwayapp/nixpacks/tree/main/examples/node-bun-prisma.

I can check this out further, but there is evidence of both working so I am not sure what is going on with your specific repo. Do you have a sample repo that doesn't work with Bun?

from nixpacks.

Maxim-Filimonov avatar Maxim-Filimonov commented on June 30, 2024

@coffee-cup I tried using linked example and it fails with different error for some reason.



$ bunx prisma migrate deploy

Prisma schema loaded from prisma/schema.prisma

Datasource "db": PostgreSQL database "railway", schema "public" at "roundhouse.proxy.rlwy.net:17360"

Error: P1001: Can't reach database server at `roundhouse.proxy.rlwy.net`:`17360`

Please make sure your database server is running at `roundhouse.proxy.rlwy.net`:`17360`.

error: script "start" exited with code 1 (SIGHUP)

$ bunx prisma migrate deploy

I did add shared variable DATABASE_URL.
Project on railway -> https://railway.app/project/f43b6f45-bce0-4138-bb1f-4dedca53ed97
Tried recreating postgres service - no luck.

Also tried using PRIVATE_DATABASE_URL from pg got this instead:

Error: P1001: Can't reach database server at `postgres.railway.internal`:`5432`

Please make sure your database server is running at `postgres.railway.internal`:`5432`.

from nixpacks.

baptisteArno avatar baptisteArno commented on June 30, 2024

I have the exact same error when trying to deploy an Elysia app. Has anyone found a fix?

from nixpacks.

iloveitaly avatar iloveitaly commented on June 30, 2024

--libs openssl will fix the issue, or we can get this PR merged :)

#1054

from nixpacks.

iloveitaly avatar iloveitaly commented on June 30, 2024

You need it as a lib, not as a package. Without this the ENV config is not changed. Take a look at the linked PR: #1054

from nixpacks.

GautierT avatar GautierT commented on June 30, 2024

Hey !
I did not quite understand the latest message. What is the solution to avoid this error : Unable to require(/app/node_modules/.prisma/client/libquery_engine-debian-openssl-3.0.x.so.node). 2024-03-13T14:39:50.020131817Z Prisma cannot find the required libssl system library in your system. Please install openssl-3.0.x and try again.

Thanks !

from nixpacks.

ksaitor avatar ksaitor commented on June 30, 2024

Even on the latest prisma@^5.11.0 still getting this error on Nixpacks (running inside Coolify)

╔═════════════ Nixpacks v1.21.2 ═════════════╗
║ setup │ nodejs_21, bun, openssl ║
║────────────────────────────────────────────║
║ install │ bun i --no-save ║
║────────────────────────────────────────────║
║ build │ echo Skip build process ║
║────────────────────────────────────────────║
║ start │ bun run worker/main.worker.ts ║
╚════════════════════════════════════════════╝
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.

from nixpacks.

ksaitor avatar ksaitor commented on June 30, 2024

--libs openssl

where do you add --libs openssl ? @iloveitaly

@Maxim-Filimonov were you able to resolve this?

from nixpacks.

Maxim-Filimonov avatar Maxim-Filimonov commented on June 30, 2024

@ksaitor I haven't tried since it wasn't working when I needed it for initial launch. It works pretty well on fly I don't really see a reason why try to move it back to railway TBH.

from nixpacks.

JakeCooper avatar JakeCooper commented on June 30, 2024

Fixable by simply specifying binaryTargets

amorriscode/elysia-starter#2 (comment)

from nixpacks.

ksaitor avatar ksaitor commented on June 30, 2024

added NIXPACKS_LIBS=openssl and it worked!
notice: not NIXPACKS_PKGS

cc @baptisteArno check it out

from nixpacks.

JakeCooper avatar JakeCooper commented on June 30, 2024

@ksaitor Could you link the Railway project where it works or a repo with it working so that we can fix it at the nixpacks level?

from nixpacks.

ksaitor avatar ksaitor commented on June 30, 2024

@ksaitor Could you link the Railway project where it works or a repo with it working so that we can fix it at the nixpacks level?

@JakeCooper I'm not on Railway. I'm on Coolify, that's using Nixpacks under the hood. Nixpacks v1.21.2.

from nixpacks.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.