uralsmh
uralsmh
PPrisma
Created by uralsmh on 8/4/2024 in #help-and-questions
Issues with Prisma 5.3.1: OpenSSL Version Mismatch during Build and Runtime in Docker
I am encountering issues with my setup involving Prisma 5.3.1 and Docker. During the build process, I receive the following error: in this GitHub issue, https://github.com/prisma/prisma/issues/16232 which suggests that there is no need to install OpenSSL manually. However, this did not resolve the issue for me.Is there a specific configuration I am missing in my Dockerfile or schema.prisma file that can ensure compatibility? Is there a recommended way to ensure that the Prisma Client is correctly generated for the required OpenSSL version within a Docker environment? Project Details: Prisma Version: 5.3.1 Node Version: 20 Docker Image: node:20-bookworm and node:20-bookworm-slim
FROM node:20-bookworm AS build
WORKDIR /app
RUN --mount=type=cache,target=/var/cache/apt \
apt-get update && \
apt-get --no-install-recommends install -y openssl && \
rm -rf /var/lib/apt/lists/*
COPY package.json package-lock.json tsconfig.json ./
COPY prisma/schema.prisma ./
RUN --mount=type=cache,target=/app/.npm \
npm set cache /app/.npm && \
npm ci
COPY . .
RUN npx prisma generate && npm run build

FROM node:20-bookworm-slim AS runtime
WORKDIR /app
COPY --from=build /app/node_modules ./node_modules
COPY --from=build /app/prisma/schema.prisma ./prisma/schema.prisma
COPY --from=build /app/package.json ./package.json
COPY --from=build /app/package-lock.json ./package-lock.json
COPY --from=build /app/dist ./dist

FROM runtime AS collector
CMD ["node","./dist/collector/server.js"]

FROM runtime AS workers
CMD ["node","./dist/workers/master.js"]

FROM runtime AS api
CMD ["node","./dist/api/server.js"]

FROM runtime AS webhook
CMD ["node", "./dist/webhook/server.js"]
FROM node:20-bookworm AS build
WORKDIR /app
RUN --mount=type=cache,target=/var/cache/apt \
apt-get update && \
apt-get --no-install-recommends install -y openssl && \
rm -rf /var/lib/apt/lists/*
COPY package.json package-lock.json tsconfig.json ./
COPY prisma/schema.prisma ./
RUN --mount=type=cache,target=/app/.npm \
npm set cache /app/.npm && \
npm ci
COPY . .
RUN npx prisma generate && npm run build

FROM node:20-bookworm-slim AS runtime
WORKDIR /app
COPY --from=build /app/node_modules ./node_modules
COPY --from=build /app/prisma/schema.prisma ./prisma/schema.prisma
COPY --from=build /app/package.json ./package.json
COPY --from=build /app/package-lock.json ./package-lock.json
COPY --from=build /app/dist ./dist

FROM runtime AS collector
CMD ["node","./dist/collector/server.js"]

FROM runtime AS workers
CMD ["node","./dist/workers/master.js"]

FROM runtime AS api
CMD ["node","./dist/api/server.js"]

FROM runtime AS webhook
CMD ["node", "./dist/webhook/server.js"]
6 replies
PPrisma
Created by uralsmh on 6/18/2024 in #help-and-questions
prisma is generating some crappy migrations for no reason
Hey folks, Can someone guide me why prims is generating some crappy migrations for no reason? I mean why it deletes the constraint ActionDependencyList_pkey and add it again after?
-- AlterTable
ALTER TABLE "ActionDependencyList" DROP CONSTRAINT "ActionDependencyList_pkey", --->here
ADD COLUMN "filename" TEXT NOT NULL,
DROP COLUMN "actions",
ADD COLUMN "actions" TEXT[],
ADD CONSTRAINT "ActionDependencyList_pkey" PRIMARY KEY ("repository_id", "filename");

-- AlterTable
ALTER TABLE "DailyRunnerCost" RENAME CONSTRAINT "CostTable_pkey" TO "DailyRunnerCost_pkey";

-- AddForeignKey
ALTER TABLE "ActionDependencyList" ADD CONSTRAINT "ActionDependencyList_repository_id_fkey" FOREIGN KEY ("repository_id") REFERENCES "Repository"("repository_id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AlterTable
ALTER TABLE "ActionDependencyList" DROP CONSTRAINT "ActionDependencyList_pkey", --->here
ADD COLUMN "filename" TEXT NOT NULL,
DROP COLUMN "actions",
ADD COLUMN "actions" TEXT[],
ADD CONSTRAINT "ActionDependencyList_pkey" PRIMARY KEY ("repository_id", "filename");

-- AlterTable
ALTER TABLE "DailyRunnerCost" RENAME CONSTRAINT "CostTable_pkey" TO "DailyRunnerCost_pkey";

-- AddForeignKey
ALTER TABLE "ActionDependencyList" ADD CONSTRAINT "ActionDependencyList_repository_id_fkey" FOREIGN KEY ("repository_id") REFERENCES "Repository"("repository_id") ON DELETE RESTRICT ON UPDATE CASCADE;
2 replies
PPrisma
Created by uralsmh on 5/24/2024 in #help-and-questions
ERROR: column "filename" of relation "ActionDependencyList" contains null values
Sorry for the noob question but I am a bit confused what should I do after this error. Can someone help me please?
npx prisma migrate dev  ✔  16s   22:16:18 
Environment variables loaded from .env
Prisma schema loaded from prisma/schema.prisma
Datasource "db": PostgreSQL database "watchtower_db", schema "public" at "localhost:5432"

Applying migration `20240524201618_`
Error: P3018

A migration failed to apply. New migrations cannot be applied before the error is recovered from. Read more about how to resolve migration issues in a production database: https://pris.ly/d/migrate-resolve

Migration name: 20240524201618_

Database error code: 23502

Database error:
ERROR: column "filename" of relation "ActionDependencyList" contains null values

DbError { severity: "ERROR", parsed_severity: Some(Error), code: SqlState(E23502), message: "column \"filename\" of relation \"ActionDependencyList\" contains null values", detail: None, hint: None, position: None, where_: None, schema: Some("public"), table: Some("ActionDependencyList"), column: Some("filename"), datatype: None, constraint: None, file: Some("tablecmds.c"), line: Some(6046), routine: Some("ATRewriteTable") }
npx prisma migrate dev  ✔  16s   22:16:18 
Environment variables loaded from .env
Prisma schema loaded from prisma/schema.prisma
Datasource "db": PostgreSQL database "watchtower_db", schema "public" at "localhost:5432"

Applying migration `20240524201618_`
Error: P3018

A migration failed to apply. New migrations cannot be applied before the error is recovered from. Read more about how to resolve migration issues in a production database: https://pris.ly/d/migrate-resolve

Migration name: 20240524201618_

Database error code: 23502

Database error:
ERROR: column "filename" of relation "ActionDependencyList" contains null values

DbError { severity: "ERROR", parsed_severity: Some(Error), code: SqlState(E23502), message: "column \"filename\" of relation \"ActionDependencyList\" contains null values", detail: None, hint: None, position: None, where_: None, schema: Some("public"), table: Some("ActionDependencyList"), column: Some("filename"), datatype: None, constraint: None, file: Some("tablecmds.c"), line: Some(6046), routine: Some("ATRewriteTable") }
12 replies