R
Railway•8mo ago
Harris

prisma client issues with monorepo workspaces

Not quite sure how to fix this, it can't seem to find the prisma client?
No description
No description
No description
Solution:
i had a custom start command overriding the one i had in my dockerfile
Jump to solution
64 Replies
Percy
Percy•8mo ago
Project ID: 893df018-6917-4ca3-b43d-6db80b4819ca
Harris
HarrisOP•8mo ago
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.
Harris
HarrisOP•8mo ago
I tried copying over my Dockerfile from my other bun/prisma project but that failed too
Harris
HarrisOP•8mo ago
No description
Harris
HarrisOP•8mo 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
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
but I have turbo in my package.json? so I'm confused on why it's failing
Harris
HarrisOP•8mo ago
Gist
buildlogs
GitHub Gist: instantly share code, notes, and snippets.
Brody
Brody•8mo ago
you can send files in discord too 😆
Harris
HarrisOP•8mo ago
sorry, i was just trying to copy it without a bookmarklet 😅
Brody
Brody•8mo ago
may i quicky as why no bookmarklet?
Harris
HarrisOP•8mo ago
honestly, i don't know how to use bookmarks on arc i'll past the js into console
Brody
Brody•8mo ago
i havent heard of anyone using bookmarklets on arc
Brody
Brody•8mo ago
do you have a root directory set?
Harris
HarrisOP•8mo ago
oh perhaps not
Harris
HarrisOP•8mo ago
No description
Harris
HarrisOP•8mo ago
i don't see an option for that?
Brody
Brody•8mo ago
just asking to gather info, not an actionable question, but the root directory setting is in the source section of the service settings can you send the package.json in your root?
Harris
HarrisOP•8mo ago
OH wait found the root directory option
{
"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": "[email protected]",
"workspaces": [
"apps/*",
"packages/*"
]
}
{
"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": "[email protected]",
"workspaces": [
"apps/*",
"packages/*"
]
}
Brody
Brody•8mo ago
unless im blind, no priama there, so its not going to be installed
Harris
HarrisOP•8mo ago
there's prisma in the server package.json
{
"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"
}
}
{
"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"
}
}
oh wait
Brody
Brody•8mo ago
exactly, so you will need an install command that installs the deps from the server app
Harris
HarrisOP•8mo ago
i don't have a build script although
Brody
Brody•8mo ago
im sure that can be one of the issues, but its not the issue
Harris
HarrisOP•8mo ago
bun should install all deps from root tho
Harris
HarrisOP•8mo ago
No description
Brody
Brody•8mo ago
doesnt seem like it is on railway, besides even if it did, would you want to install deps from the client? could this be a case of railway running an old bun version?
Harris
HarrisOP•8mo ago
my bun / turborepo / workspaces knowledge is rusty i know in my other prject that's similar I swapped to a dockerfile
Brody
Brody•8mo ago
and mine is non existent Dockerfile is always an option, would get you the latest bun version on every deploy thats for sure
Harris
HarrisOP•8mo ago
so i added the dockerfile and i'm getting exec turbo not found and so to be honest I'm confused on how my old code is working lol
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
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
is what I have right now
Brody
Brody•8mo ago
how do you know the dockerfile is being used?
Harris
HarrisOP•8mo ago
it gets used by default i thought
Brody
Brody•8mo ago
i mean yeah but you still gotta make sure
Harris
HarrisOP•8mo ago
hmm
Harris
HarrisOP•8mo ago
No description
Harris
HarrisOP•8mo ago
this should be install turbo
Harris
HarrisOP•8mo ago
No description
Brody
Brody•8mo ago
where is that dockerfile located?
Harris
HarrisOP•8mo ago
root
Brody
Brody•8mo ago
you dont have turbo in the server package.json
Harris
HarrisOP•8mo ago
the server doesn't need it
Brody
Brody•8mo ago
but you are trying to use it
Harris
HarrisOP•8mo ago
it should only be needed in the root level package.json from my understanding since bun installs
Harris
HarrisOP•8mo ago
No description
Brody
Brody•8mo ago
you are cd'ing into the server directory though
Harris
HarrisOP•8mo ago
i removed that (bun ignores the cd anyways, and just installs the whole workspace)
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
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
right now i get
Brody
Brody•8mo ago
theres still cd there, please remove
Harris
HarrisOP•8mo ago
No description
Harris
HarrisOP•8mo ago
which?
Brody
Brody•8mo ago
cd /usr/src/app
Harris
HarrisOP•8mo ago
do i not need that for the CMD to function right
Brody
Brody•8mo ago
no, its set by WORKDIR /usr/src/app
Harris
HarrisOP•8mo ago
No description
Brody
Brody•8mo ago
try moving turbo out of dev deps
Harris
HarrisOP•8mo ago
No description
Brody
Brody•8mo ago
hmmm im running out of ideas
Harris
HarrisOP•8mo ago
i found the source of all my pain
Harris
HarrisOP•8mo ago
No description
Harris
HarrisOP•8mo ago
and got it working
Solution
Harris
Harris•8mo ago
i had a custom start command overriding the one i had in my dockerfile
Brody
Brody•8mo ago
conductors getting metadata about the users service can't come soon enough
Harris
HarrisOP•8mo ago
thnks for the help in finding it!
Brody
Brody•8mo ago
happy to help where i can
Want results from more Discord servers?
Add your server