prisma client issues with monorepo workspaces

developerharrisHOBBY

a year ago

Not quite sure how to fix this, it can't seem to find the prisma client?

0 Replies


developerharrisHOBBY

a year ago

I tried copying over my Dockerfile from my other bun/prisma project but that failed too


developerharrisHOBBY

a year ago

1221628263609401300


developerharrisHOBBY

a year ago

FROM oven/bun:1 as base
WORKDIR /usr/src/app

RUN apt update \
    && apt install -y curl

# Install nodejs using n
ARG NODE_VERSION=18
RUN curl -L https://raw.githubusercontent.com/tj/n/master/bin/n -o n \
    && bash n $NODE_VERSION \
    && rm n \
    && npm install -g n

COPY . .
ARG DATABASE_URL
ARG DIRECT_URL
RUN cd ./apps/ws_server && bun install --frozen-lockfile && cd /usr/src/app

ENV NODE_ENV=production
# RUN bunx prisma generate
RUN bunx turbo run build --filter=ws_server

CMD bunx turbo run start --filter=ws_server

developerharrisHOBBY

a year ago

but I have turbo in my package.json? so I'm confused on why it's failing


a year ago

build logs please



a year ago

you can send files in discord too 😆


developerharrisHOBBY

a year ago

sorry, i was just trying to copy it without a bookmarklet 😅


a year ago

may i quicky as why no bookmarklet?


developerharrisHOBBY

a year ago

honestly, i don't know how to use bookmarks on arc


developerharrisHOBBY

a year ago

i'll past the js into console


a year ago

i havent heard of anyone using bookmarklets on arc


developerharrisHOBBY

a year ago


a year ago

do you have a root directory set?


developerharrisHOBBY

a year ago

oh perhaps not


developerharrisHOBBY

a year ago


developerharrisHOBBY

a year ago

1221634244514808000


developerharrisHOBBY

a year ago

i don't see an option for that?


a year ago

just asking to gather info, not an actionable question, but the root directory setting is in the source section of the service settings


a year ago

can you send the package.json in your root?


developerharrisHOBBY

a year ago

OH


developerharrisHOBBY

a year ago

wait


developerharrisHOBBY

a year ago

found the root directory option


developerharrisHOBBY

a year ago

{
  "name": "discord-dnd",
  "private": true,
  "scripts": {
    "build": "turbo build",
    "dev": "turbo dev",
    "start": "turbo start",
    "lint": "turbo lint",
    "format": "prettier --write \"**/*.{ts,tsx,md}\""
  },
  "devDependencies": {
    "@repo/eslint-config": "*",
    "@repo/typescript-config": "*",
    "discord-api-types": "^0.37.76",
    "prettier": "^3.2.5",
    "turbo": "latest"
  },
  "engines": {
    "node": ">=18"
  },
  "packageManager": "bun@1.0.30",
  "workspaces": [
    "apps/*",
    "packages/*"
  ]
}

a year ago

unless im blind, no priama there, so its not going to be installed


developerharrisHOBBY

a year ago

there's prisma in the server package.json


developerharrisHOBBY

a year ago

{
    "name": "server",
    "module": "index.ts",
    "type": "module",
    "scripts": {
        "dev": "bun index.ts",
        "start": "bun index.ts",
        "db:generate": "prisma generate",
        "db:push": "prisma db push --skip-generate"
    },
    "devDependencies": {
        "@types/bun": "latest",
        "prisma": "5.11.0"
    },
    "peerDependencies": {
        "typescript": "^5.0.0",
        "@repo/typescript-config": "*"
    },
    "dependencies": {
        "@prisma/client": "5.11.0"
    }
}

developerharrisHOBBY

a year ago

oh wait


a year ago

exactly, so you will need an install command that installs the deps from the server app


developerharrisHOBBY

a year ago

i don't have a build script


developerharrisHOBBY

a year ago

although


a year ago

im sure that can be one of the issues, but its not the issue


developerharrisHOBBY

a year ago

bun should install all deps from root tho


developerharrisHOBBY

a year ago

1221635915751883000


a year ago

doesnt seem like it is on railway, besides even if it did, would you want to install deps from the client?


a year ago

could this be a case of railway running an old bun version?


developerharrisHOBBY

a year ago

my bun / turborepo / workspaces knowledge is rusty


developerharrisHOBBY

a year ago

i know in my other prject that's similar I swapped to a dockerfile


a year ago

and mine is non existent


a year ago

Dockerfile is always an option, would get you the latest bun version on every deploy thats for sure


developerharrisHOBBY

a year ago

so i added the dockerfile


developerharrisHOBBY

a year ago

and i'm getting exec turbo not found


developerharrisHOBBY

a year ago

and so to be honest


developerharrisHOBBY

a year ago

I'm confused on how my old code is working lol


developerharrisHOBBY

a year ago

FROM oven/bun:1 as base
WORKDIR /usr/src/app

RUN apt update \
    && apt install -y curl

# Install nodejs using n
ARG NODE_VERSION=18
RUN curl -L https://raw.githubusercontent.com/tj/n/master/bin/n -o n \
    && bash n $NODE_VERSION \
    && rm n \
    && npm install -g n

COPY . .
ARG DATABASE_URL
RUN cd ./apps/server && bun install --frozen-lockfile && cd /usr/src/app

ENV NODE_ENV=production
# RUN bunx prisma generate
RUN bunx turbo run build --filter=server

CMD bunx turbo run start --filter=server

developerharrisHOBBY

a year ago

is what I have right now


a year ago

how do you know the dockerfile is being used?


developerharrisHOBBY

a year ago

it gets used by default i thought


a year ago

i mean yeah but you still gotta make sure


developerharrisHOBBY

a year ago

hmm


developerharrisHOBBY

a year ago

1221639170628522000


developerharrisHOBBY

a year ago

this should be install turbo


developerharrisHOBBY

a year ago

1221639243110289400


a year ago

where is that dockerfile located?


developerharrisHOBBY

a year ago

root


a year ago

you have turbo listed as a dev dep, maybe thats why?


a year ago

you dont have turbo in the server package.json


developerharrisHOBBY

a year ago

the server doesn't need it


a year ago

but you are trying to use it


developerharrisHOBBY

a year ago

it should only be needed in the root level package.json from my understanding


developerharrisHOBBY

a year ago

since bun installs


developerharrisHOBBY

a year ago

1221641087857201200


a year ago

you are cd'ing into the server directory though


developerharrisHOBBY

a year ago

i removed that


developerharrisHOBBY

a year ago

(bun ignores the cd anyways, and just installs the whole workspace)


developerharrisHOBBY

a year ago

FROM oven/bun:1 as base
WORKDIR /usr/src/app

RUN apt update \
    && apt install -y curl

ARG NODE_VERSION=18
RUN curl -L https://raw.githubusercontent.com/tj/n/master/bin/n -o n \
    && bash n $NODE_VERSION \
    && rm n \
    && npm install -g n

COPY . .
ARG DATABASE_URL
RUN bun install --frozen-lockfile && cd /usr/src/app

ENV NODE_ENV=production

CMD bunx turbo run start --filter=server

developerharrisHOBBY

a year ago

right now i get


a year ago

theres still cd there, please remove


developerharrisHOBBY

a year ago

1221641274025705500


developerharrisHOBBY

a year ago

which?


a year ago

cd /usr/src/app


developerharrisHOBBY

a year ago

do i not need that for the CMD to function right


a year ago

no, its set by WORKDIR /usr/src/app


developerharrisHOBBY

a year ago

1221641663231955000


a year ago

try moving turbo out of dev deps


developerharrisHOBBY

a year ago

1221642035292016600


a year ago

hmmm im running out of ideas


developerharrisHOBBY

a year ago

i found the source of all my pain


developerharrisHOBBY

a year ago

1221645060177920000


developerharrisHOBBY

a year ago

and got it working


developerharrisHOBBY

a year ago

i had a custom start command overriding the one i had in my dockerfile


a year ago

conductors getting metadata about the users service can't come soon enough


developerharrisHOBBY

a year ago

thnks for the help in finding it!


a year ago

happy to help where i can