P
Prisma6mo ago
roobr

Nuxt 3 - Prisma building production

Hi Guys, it seems like I am havcing issues with my Prisma sections of my system working once i build and run my application. Just wondering if there is another step I am missing as it works fine when doing it on my dev server using pnpm run dev. Thanks in advance
15 Replies
roobr
roobrOP6mo ago
@prisma/client did not initialize yet. Please run "prisma generate" and try to import it again. In case this error is unexpected for you, please report it in https://pris.ly/prisma-prisma-bug-report
@prisma/client did not initialize yet. Please run "prisma generate" and try to import it again. In case this error is unexpected for you, please report it in https://pris.ly/prisma-prisma-bug-report
This is what I get, I am running this in a docker container, should I have to make a change to the build process to include prisma schema? I have since fixed the initialisation but now it seems any prisma calls are crashing my bun instance
frontend-1 | ============================================================
frontend-1 | Bun v1.1.10 (5102a944) Linux x64 (baseline)
frontend-1 | Args: "bun" "run" "/app/output/server/index.mjs"
frontend-1 | Features: jsc Bun.stdin(2) fetch(3) http_server spawn
frontend-1 | Builtins: "bun:main" "node:async_hooks" "node:buffer" "node:child_process" "node:crypto" "node:events" "node:fs" "node:fs/promises" "node:http" "node:https" "node:os" "node:path" "node:process" "node:stream" "node:string_decoder" "node:tty" "node:url" "node:util" "node:util/types" "node:zlib" "node:punycode"
frontend-1 | Elapsed: 80704ms | User: 790ms | Sys: 148ms
frontend-1 | RSS: 0.94GB | Peak: 0.17GB | Commit: 0.94GB | Faults: 0
frontend-1 |
frontend-1 | panic(main thread): Segmentation fault at address 0x4A0D0
frontend-1 | oh no: Bun has crashed. This indicates a bug in Bun, not your code.
frontend-1 |
frontend-1 | To send a redacted crash report to Bun's team,
frontend-1 | please file a GitHub issue using the link below:
frontend-1 |
frontend-1 | https://bun.report/1.1.10/Br15102a94AqgihI2/tkjEA2AgtwS
frontend-1 |
frontend-1 exited with code 0
frontend-1 | ============================================================
frontend-1 | Bun v1.1.10 (5102a944) Linux x64 (baseline)
frontend-1 | Args: "bun" "run" "/app/output/server/index.mjs"
frontend-1 | Features: jsc Bun.stdin(2) fetch(3) http_server spawn
frontend-1 | Builtins: "bun:main" "node:async_hooks" "node:buffer" "node:child_process" "node:crypto" "node:events" "node:fs" "node:fs/promises" "node:http" "node:https" "node:os" "node:path" "node:process" "node:stream" "node:string_decoder" "node:tty" "node:url" "node:util" "node:util/types" "node:zlib" "node:punycode"
frontend-1 | Elapsed: 80704ms | User: 790ms | Sys: 148ms
frontend-1 | RSS: 0.94GB | Peak: 0.17GB | Commit: 0.94GB | Faults: 0
frontend-1 |
frontend-1 | panic(main thread): Segmentation fault at address 0x4A0D0
frontend-1 | oh no: Bun has crashed. This indicates a bug in Bun, not your code.
frontend-1 |
frontend-1 | To send a redacted crash report to Bun's team,
frontend-1 | please file a GitHub issue using the link below:
frontend-1 |
frontend-1 | https://bun.report/1.1.10/Br15102a94AqgihI2/tkjEA2AgtwS
frontend-1 |
frontend-1 exited with code 0
Nurul
Nurul6mo ago
Hey @roobr 👋 I see a similar issue reported here in Bun repository: https://github.com/oven-sh/bun/issues/10457 Could you try using Bun v1.0.18 and check if you get the same error?
GitHub
postinstall script from "@prisma/engines" terminated by SIGILL (Ill...
How can we reproduce the crash? Run bun install on project with Next and Prisma in Linux environment Host kernel: 5.15.0-105-generic Docker: 26.1.0 Relevant log output 0.757 bun install v1.1.5 (ab7...
roobr
roobrOP6mo ago
I did try to update bun but not sure if I need to force it in my docker container? My container is as follows
# Base image with Node.js
FROM node:lts-slim AS base
WORKDIR /app
RUN apt-get update && apt-get install -y openssl
RUN npm i -g bun

# Install dependencies into temp directory
# This will cache them and speed up future builds
FROM base AS install
COPY package.json bun.lockb ./
COPY . .
RUN bun install --frozen-lockfile

# Copy project files into the image

# [Optional] tests & build
ENV NODE_ENV=production
RUN bun run build

# Copy production dependencies and source code into final image
FROM oven/bun:alpine AS runtime
WORKDIR /app

# Copy necessary files from the 'install' stage to the 'runtime' stage
# COPY --from=install /app/node_modules ./node_modules
COPY --from=install /app/.output ./output

# Set user and expose port
USER bun
EXPOSE 3000/tcp

# Run the app
ENTRYPOINT [ "sh", "-c", "bun run /app/output/server/index.mjs" ]
# Base image with Node.js
FROM node:lts-slim AS base
WORKDIR /app
RUN apt-get update && apt-get install -y openssl
RUN npm i -g bun

# Install dependencies into temp directory
# This will cache them and speed up future builds
FROM base AS install
COPY package.json bun.lockb ./
COPY . .
RUN bun install --frozen-lockfile

# Copy project files into the image

# [Optional] tests & build
ENV NODE_ENV=production
RUN bun run build

# Copy production dependencies and source code into final image
FROM oven/bun:alpine AS runtime
WORKDIR /app

# Copy necessary files from the 'install' stage to the 'runtime' stage
# COPY --from=install /app/node_modules ./node_modules
COPY --from=install /app/.output ./output

# Set user and expose port
USER bun
EXPOSE 3000/tcp

# Run the app
ENTRYPOINT [ "sh", "-c", "bun run /app/output/server/index.mjs" ]
Thank you for your suggestion
Nurul
Nurul6mo ago
I saw here that using 1.0.18 bun version can be a temporary workaround https://github.com/oven-sh/bun/issues/8519#issuecomment-1930711713
GitHub
Error "SIGSEGV (Address boundary error)" in docker with prisma · Is...
What version of Bun is running? version 1.0.26+7492b3a20 and lower What platform is your computer? Linux 6.7.0-0-MANJARO x86_64 unknown. alpine in docker What steps can reproduce the bug? I tried t...
roobr
roobrOP6mo ago
Do you know how to force this?
Nurul
Nurul6mo ago
You can specify the specific version of bun in your dockerfile like this
# Base image with Node.js
FROM node:lts-slim AS base
WORKDIR /app
RUN apt-get update && apt-get install -y openssl
RUN npm install -g [email protected]

[Rest of the file]
# Base image with Node.js
FROM node:lts-slim AS base
WORKDIR /app
RUN apt-get update && apt-get install -y openssl
RUN npm install -g [email protected]

[Rest of the file]
roobr
roobrOP6mo ago
Unfortunately still crashes
Attaching to frontend-1
frontend-1 | Listening on http://localhost:3000...
frontend-1 | ============================================================
frontend-1 | Bun v1.1.10 (5102a944) Linux x64 (baseline)
frontend-1 | Args: "bun" "run" "/app/output/server/index.mjs"
frontend-1 | Features: jsc Bun.stdin(2) http_server spawn
frontend-1 | Builtins: "bun:main" "node:async_hooks" "node:buffer" "node:child_process" "node:crypto" "node:events" "node:fs" "node:fs/promises" "node:http" "node:https" "node:os" "node:path" "node:process" "node:stream" "node:string_decoder" "node:tty" "node:url" "node:util" "node:util/types" "node:zlib" "node:punycode"
frontend-1 | Elapsed: 9248ms | User: 522ms | Sys: 119ms
frontend-1 | RSS: 1.02GB | Peak: 0.15GB | Commit: 1.02GB | Faults: 589
frontend-1 |
frontend-1 | panic(main thread): Segmentation fault at address 0x4A0D0
frontend-1 | oh no: Bun has crashed. This indicates a bug in Bun, not your code.
frontend-1 |
frontend-1 | To send a redacted crash report to Bun's team,
frontend-1 | please file a GitHub issue using the link below:
frontend-1 |
frontend-1 | https://bun.report/1.1.10/Br15102a94AqgghI2/tkjEA2AgtwS
frontend-1 |
frontend-1 exited with code 0
Attaching to frontend-1
frontend-1 | Listening on http://localhost:3000...
frontend-1 | ============================================================
frontend-1 | Bun v1.1.10 (5102a944) Linux x64 (baseline)
frontend-1 | Args: "bun" "run" "/app/output/server/index.mjs"
frontend-1 | Features: jsc Bun.stdin(2) http_server spawn
frontend-1 | Builtins: "bun:main" "node:async_hooks" "node:buffer" "node:child_process" "node:crypto" "node:events" "node:fs" "node:fs/promises" "node:http" "node:https" "node:os" "node:path" "node:process" "node:stream" "node:string_decoder" "node:tty" "node:url" "node:util" "node:util/types" "node:zlib" "node:punycode"
frontend-1 | Elapsed: 9248ms | User: 522ms | Sys: 119ms
frontend-1 | RSS: 1.02GB | Peak: 0.15GB | Commit: 1.02GB | Faults: 589
frontend-1 |
frontend-1 | panic(main thread): Segmentation fault at address 0x4A0D0
frontend-1 | oh no: Bun has crashed. This indicates a bug in Bun, not your code.
frontend-1 |
frontend-1 | To send a redacted crash report to Bun's team,
frontend-1 | please file a GitHub issue using the link below:
frontend-1 |
frontend-1 | https://bun.report/1.1.10/Br15102a94AqgghI2/tkjEA2AgtwS
frontend-1 |
frontend-1 exited with code 0
actually seems like bun is still the old version there I have it running on 1.0.18 but now it doesnt panic it just does frontend-1 exited with code 0 Definitely a bun related issue, reverted to pnpm and works fine
Nurul
Nurul6mo ago
I would recommend creating an issue in Bun repository 🙏 Also, thanks for taking the time to get back and confirming that the issue was related to Bun 😄
roobr
roobrOP6mo ago
GitHub
Nuxt 3, Prisma · Issue #11390 · oven-sh/bun
How can we reproduce the crash? Dockerised Nuxt 3 Application seems to crash with prisma query JavaScript/TypeScript code that reproduces the crash? No response Relevant log output frontend-1 | Bun...
yinxingmaiming6409
I'm the same, have you solved it?
Nurul
Nurul5mo ago
You shouldn't use the alpine version of Bun version until this is resolved. https://github.com/oven-sh/bun/issues/11390#issuecomment-2152042510
GitHub
Nuxt 3, Prisma · Issue #11390 · oven-sh/bun
How can we reproduce the crash? Dockerised Nuxt 3 Application seems to crash with prisma query JavaScript/TypeScript code that reproduces the crash? No response Relevant log output frontend-1 | Bun...
yinxingmaiming6409
When can it be repaired? Does not support Linux Docker?
Nurul
Nurul5mo ago
This is a dependency from Bun. I would recommend subscribing to this issue to know when this will be fixed: https://github.com/oven-sh/bun/issues/918
GitHub
Musl LibC Support · Issue #918 · oven-sh/bun
What is the problem this feature will solve? It will allow bun to be used in linux distributions such as Alpine Linux or BunOS. This could also potentially solve #255. What is the feature you are p...
yinxingmaiming6409
Has it not been resolved since 2022? So it seems that it may not be possible to fix it this year, right
Nurul
Nurul5mo ago
Chances are pretty low.
Want results from more Discord servers?
Add your server