keii
keii
Explore posts from servers
PPrisma
Created by keii on 5/1/2024 in #help-and-questions
Reason why relation is giving an error when id is provided
Hello im trying to create a new row but even when the id is provided it gives an error
2024-05-01 23:58:55 Invalid `prisma.entryAlternativeTitle.create()` invocation:
2024-05-01 23:58:55
2024-05-01 23:58:55 {
2024-05-01 23:58:55 data: {
2024-05-01 23:58:55 entryId: 11,
2024-05-01 23:58:55 languageId: 326,
2024-05-01 23:58:55 title: "Ο Χάρι Πότερ και η Φιλοσοφική Λίθος",
2024-05-01 23:58:55 + entry: {
2024-05-01 23:58:55 + create: EntryCreateWithoutAlternativeTitlesInput | EntryUncheckedCreateWithoutAlternativeTitlesInput,
2024-05-01 23:58:55 + connectOrCreate: EntryCreateOrConnectWithoutAlternativeTitlesInput,
2024-05-01 23:58:55 + connect: EntryWhereUniqueInput
2024-05-01 23:58:55 + }
2024-05-01 23:58:55 }
2024-05-01 23:58:55 }
2024-05-01 23:58:55
2024-05-01 23:58:55 Argument `entry` is missing.
2024-05-01 23:58:55 Invalid `prisma.entryAlternativeTitle.create()` invocation:
2024-05-01 23:58:55
2024-05-01 23:58:55 {
2024-05-01 23:58:55 data: {
2024-05-01 23:58:55 entryId: 11,
2024-05-01 23:58:55 languageId: 326,
2024-05-01 23:58:55 title: "Ο Χάρι Πότερ και η Φιλοσοφική Λίθος",
2024-05-01 23:58:55 + entry: {
2024-05-01 23:58:55 + create: EntryCreateWithoutAlternativeTitlesInput | EntryUncheckedCreateWithoutAlternativeTitlesInput,
2024-05-01 23:58:55 + connectOrCreate: EntryCreateOrConnectWithoutAlternativeTitlesInput,
2024-05-01 23:58:55 + connect: EntryWhereUniqueInput
2024-05-01 23:58:55 + }
2024-05-01 23:58:55 }
2024-05-01 23:58:55 }
2024-05-01 23:58:55
2024-05-01 23:58:55 Argument `entry` is missing.
schema:
model EntryAlternativeTitle {
id Int @id @default(autoincrement()) @db.UnsignedInt
entryId Int @db.UnsignedInt
entry Entry @relation(fields: [entryId], references: [id], onDelete: Cascade)
countryId Int? @db.UnsignedInt
country Country? @relation(fields: [countryId], references: [id], onDelete: Cascade)
languageId Int? @db.UnsignedInt
language Language? @relation(fields: [languageId], references: [id], onDelete: Cascade)
title String

createdAt DateTime @default(now())
updatedAt DateTime @default(now()) @updatedAt
}
model EntryAlternativeTitle {
id Int @id @default(autoincrement()) @db.UnsignedInt
entryId Int @db.UnsignedInt
entry Entry @relation(fields: [entryId], references: [id], onDelete: Cascade)
countryId Int? @db.UnsignedInt
country Country? @relation(fields: [countryId], references: [id], onDelete: Cascade)
languageId Int? @db.UnsignedInt
language Language? @relation(fields: [languageId], references: [id], onDelete: Cascade)
title String

createdAt DateTime @default(now())
updatedAt DateTime @default(now()) @updatedAt
}
4 replies
PPrisma
Created by keii on 4/8/2024 in #help-and-questions
Wierd type error with prisma codegen
29.01 qrtag:build: ./prisma/client/runtime/edge-esm.js:1:1
29.01 qrtag:build: Type error: Declaration emit for this file requires using private name 'i'. An explicit type annotation may unblock declaration emit.
29.01 qrtag:build: ./prisma/client/runtime/edge-esm.js:1:1
29.01 qrtag:build: Type error: Declaration emit for this file requires using private name 'i'. An explicit type annotation may unblock declaration emit.
https://cdn.discordapp.com/attachments/1225878190891864104/1226937916312518707/image.png?ex=662695fa&is=661420fa&hm=6e04892eb54415c469c92fbe5b131f9abfcb1fbbf0f93037fd438f17eb787b21&
4 replies
PPrisma
Created by keii on 4/6/2024 in #help-and-questions
Turbo setup with prisma and pnpm
I have a setup using turborepo and running a few apps and some shared packages together and it works well in dev but i can't figure out how to setup docker, pnpm and prisma together. I've written my dockerfile below and my tree structure is Prisma; /apps/qrtag/prisma/prisma.schema /apps/qrtag/(nextjs app) /apps/qrtag/Dockerfile /docker-compose.yml Dockkerfile
# Builder
FROM node:alpine AS builder
RUN apk add --no-cache libc6-compat
RUN apk update

WORKDIR /app
RUN yarn global add turbo
COPY . .
COPY /apps/qrtag/prisma ./
RUN turbo prune --scope=qrtag --docker

# Installer
FROM node:alpine AS installer
RUN apk add --no-cache libc6-compat
RUN apk update

WORKDIR /app
RUN yarn global add pnpm
RUN yarn global add turbo

COPY --from=builder /app/out/json/ .
COPY --from=builder /app/out/pnpm-lock.yaml ./pnpm-lock.yaml
COPY --from=builder /app/out/pnpm-workspace.yaml ./pnpm-workspace.yaml
RUN pnpm fetch
RUN pnpm install --offline
RUN pnpx prisma generate

COPY --from=builder /app/out/full/ .
COPY turbo.json turbo.json

# Uncomment and use build args to enable remote caching
# ARG TURBO_TEAM
# ENV TURBO_TEAM=$TURBO_TEAM

# ARG TURBO_TOKEN
# ENV TURBO_TOKEN=$TURBO_TOKEN

RUN turbo build --filter=qrtag...

# Runner
FROM node:alpine AS runner
WORKDIR /app

RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs
USER nextjs

COPY --from=installer /app/apps/qrtag/next.config.js .
COPY --from=installer /app/apps/qrtag/package.json .

# Automatically leverage output traces to reduce image size
# https://nextjs.org/docs/advanced-features/output-file-tracing
COPY --from=installer --chown=nextjs:nodejs /app/apps/qrtag/.next/standalone ./
COPY --from=installer --chown=nextjs:nodejs /app/apps/qrtag/.next/static ./apps/qrtag/.next/static
# COPY --from=installer --chown=nextjs:nodejs /app/apps/appname/public ./apps/appname/public

CMD node apps/qrtag/server.js
# Builder
FROM node:alpine AS builder
RUN apk add --no-cache libc6-compat
RUN apk update

WORKDIR /app
RUN yarn global add turbo
COPY . .
COPY /apps/qrtag/prisma ./
RUN turbo prune --scope=qrtag --docker

# Installer
FROM node:alpine AS installer
RUN apk add --no-cache libc6-compat
RUN apk update

WORKDIR /app
RUN yarn global add pnpm
RUN yarn global add turbo

COPY --from=builder /app/out/json/ .
COPY --from=builder /app/out/pnpm-lock.yaml ./pnpm-lock.yaml
COPY --from=builder /app/out/pnpm-workspace.yaml ./pnpm-workspace.yaml
RUN pnpm fetch
RUN pnpm install --offline
RUN pnpx prisma generate

COPY --from=builder /app/out/full/ .
COPY turbo.json turbo.json

# Uncomment and use build args to enable remote caching
# ARG TURBO_TEAM
# ENV TURBO_TEAM=$TURBO_TEAM

# ARG TURBO_TOKEN
# ENV TURBO_TOKEN=$TURBO_TOKEN

RUN turbo build --filter=qrtag...

# Runner
FROM node:alpine AS runner
WORKDIR /app

RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs
USER nextjs

COPY --from=installer /app/apps/qrtag/next.config.js .
COPY --from=installer /app/apps/qrtag/package.json .

# Automatically leverage output traces to reduce image size
# https://nextjs.org/docs/advanced-features/output-file-tracing
COPY --from=installer --chown=nextjs:nodejs /app/apps/qrtag/.next/standalone ./
COPY --from=installer --chown=nextjs:nodejs /app/apps/qrtag/.next/static ./apps/qrtag/.next/static
# COPY --from=installer --chown=nextjs:nodejs /app/apps/appname/public ./apps/appname/public

CMD node apps/qrtag/server.js
docker-compose.yml
version: '3.8'
services:
mysql:
image: mysql:5.7
restart: always
ports:
- 3306:3306
expose:
- 3306
environment:
MYSQL_ROOT_PASSWORD: prisma
MYSQL_PASSWORD: prisma
MYSQL_USER: prisma
MYSQL_DATABASE: qrtag
volumes:
- mysql:/var/lib/mysql
app:
container_name: qrtag
build:
context: .
dockerfile: ./apps/qrtag/Dockerfile
ports:
- '3001:3001'
volumes:
mysql: ~
version: '3.8'
services:
mysql:
image: mysql:5.7
restart: always
ports:
- 3306:3306
expose:
- 3306
environment:
MYSQL_ROOT_PASSWORD: prisma
MYSQL_PASSWORD: prisma
MYSQL_USER: prisma
MYSQL_DATABASE: qrtag
volumes:
- mysql:/var/lib/mysql
app:
container_name: qrtag
build:
context: .
dockerfile: ./apps/qrtag/Dockerfile
ports:
- '3001:3001'
volumes:
mysql: ~
.dockerignore
**/node_modules
node_modules
**/node_modules
node_modules
2 replies
PPrisma
Created by keii on 3/30/2024 in #help-and-questions
Cannot select both '$scalars: true' and a specific scalar field 'tags'.
This is my relevant schema
model EventTag {
id Int @id @default(autoincrement()) @db.UnsignedInt
eventUserId Int @db.UnsignedInt
targetId Int @db.UnsignedInt
timestamp DateTime @default(now()) @db.DateTime(0)
target User @relation("event_tags_target_idTousers", fields: [targetId], references: [id], onUpdate: Restrict, map: "event_tags_target_id_foreign")
eventUser EventUser @relation(fields: [eventUserId], references: [id])

@@index([targetId], map: "event_tags_target_id_foreign")
}

model EventUser {
id Int @id @default(autoincrement()) @db.UnsignedInt
userId Int @db.UnsignedInt
eventId Int @db.UnsignedInt
isAlive Boolean @default(true)
secret String @db.VarChar(255)
targetId Int @db.UnsignedInt
event Event @relation(fields: [eventId], references: [id], onUpdate: Restrict, map: "event_users_event_id_foreign")
target User @relation("event_users_target_idTousers", fields: [targetId], references: [id], onUpdate: Restrict, map: "event_users_target_id_foreign")
user User @relation("event_users_user_idTousers", fields: [userId], references: [id], onUpdate: Restrict, map: "event_users_user_id_foreign")
tags EventTag[]

@@index([eventId], map: "event_users_event_id_foreign")
@@index([targetId], map: "event_users_target_id_foreign")
@@index([userId], map: "event_users_user_id_foreign")
}
model EventTag {
id Int @id @default(autoincrement()) @db.UnsignedInt
eventUserId Int @db.UnsignedInt
targetId Int @db.UnsignedInt
timestamp DateTime @default(now()) @db.DateTime(0)
target User @relation("event_tags_target_idTousers", fields: [targetId], references: [id], onUpdate: Restrict, map: "event_tags_target_id_foreign")
eventUser EventUser @relation(fields: [eventUserId], references: [id])

@@index([targetId], map: "event_tags_target_id_foreign")
}

model EventUser {
id Int @id @default(autoincrement()) @db.UnsignedInt
userId Int @db.UnsignedInt
eventId Int @db.UnsignedInt
isAlive Boolean @default(true)
secret String @db.VarChar(255)
targetId Int @db.UnsignedInt
event Event @relation(fields: [eventId], references: [id], onUpdate: Restrict, map: "event_users_event_id_foreign")
target User @relation("event_users_target_idTousers", fields: [targetId], references: [id], onUpdate: Restrict, map: "event_users_target_id_foreign")
user User @relation("event_users_user_idTousers", fields: [userId], references: [id], onUpdate: Restrict, map: "event_users_user_id_foreign")
tags EventTag[]

@@index([eventId], map: "event_users_event_id_foreign")
@@index([targetId], map: "event_users_target_id_foreign")
@@index([userId], map: "event_users_user_id_foreign")
}
and this is my query
return await prisma.eventUser.findMany({
where: {
eventId: event.id,
},
include: {
user: true,
tags: true,
},
});
return await prisma.eventUser.findMany({
where: {
eventId: event.id,
},
include: {
user: true,
tags: true,
},
});
how would i fix this error?
Cannot select both '$scalars: true' and a specific scalar field 'tags'.
Cannot select both '$scalars: true' and a specific scalar field 'tags'.
I've checked relevant github issues and seems like this error is common and vague
4 replies