mohammad nowresideh
05/11/2021, 10:30 AMgraphql
and prisma
with postgres database, when i try to deploy schema.graphql
file with prisma1 deploy
command it gives me an error.
{
"data": {
"addProject": null
},
"errors": [
{
"message": "Whoops. Looks like an internal server error. Search your server logs for request ID: local:ckoj44v3i02hc0877ny7w1j6q",
"path": [
"addProject"
],
"locations": [
{
"line": 2,
"column": 9
}
],
"requestId": "local:ckoj44v3i02hc0877ny7w1j6q"
}
],
"status": 200
}
docker logs:
Warning: Management API authentication is disabled. To protect your management server you should provide one (not both) of the environment variables 'CLUSTER_PUBLIC_KEY' (asymmetric, deprecated soon) or 'PRISMA_MANAGEMENT_API_JWT_SECRET' (symmetric JWT).
{"key":"error/unhandled","requestId":"local:ckoj44v3i02hc0877ny7w1j6q","payload":{"exception":"org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint \"Project_pkey\"\n Detail: Key (id)=(reviews$default) already exists.","query":" mutation addProject($name: String! $stage: String! $secrets: [String!]) {\n addProject(input: {\n name: $name,\n stage: $stage\n secrets: $secrets\n }) {\n project {\n name\n }\n }\n }\n ","variables":"{\"name\":\"reviews\",\"stage\":\"default\",\"secrets\":null}","code":"0","stack_trace":"org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2433)\\n org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2178)\\n org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:306)\\n org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:441)\\n org.postgresql.jdbc.PgStatement.execute(PgStatement.java:365)\\n org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:155)\\n org.postgresql.jdbc.PgPreparedStatement.execute(PgPreparedStatement.java:144)\\n com.prisma.connector.shared.jdbc.SharedSlickExtensions.$anonfun$insertToDBIO$1(SharedSlickExtensions.scala:37)\\n com.prisma.connector.shared.jdbc.SharedSlickExtensions.$anonfun$insertToDBIO$1$adapted(SharedSlickExtensions.scala:37)\\n com.prisma.connector.shared.jdbc.SharedSlickExtensions.$anonfun$jooqToDBIO$1(SharedSlickExtensions.scala:56)\\n slick.jdbc.SimpleJdbcAction.run(StreamingInvokerAction.scala:70)\\n slick.jdbc.SimpleJdbcAction.run(StreamingInvokerAction.scala:69)\\n slick.basic.BasicBackend$DatabaseDef$$anon$3.liftedTree1$1(BasicBackend.scala:276)\\n slick.basic.BasicBackend$DatabaseDef$$anon$3.run(BasicBackend.scala:276)\\n java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)\\n java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)\\n java.lang.Thread.run(Thread.java:748)","message":"ERROR: duplicate key value violates unique constraint \"Project_pkey\"\n Detail: Key (id)=(reviews$default) already exists."}}
James
05/11/2021, 1:24 PMprisma generate
on my Bitbucket pipelines as of 24 hours ago, can't seem to solve it. I've tried updating to latest version (2.22.1), as well as changing binaryTargets = ["debian-openssl-1.1.x"] (was native). I'm using image: node:14-buster for the runner. The problem i s it hangs forever with no output other than
+ NODE_OPTIONS=--max_old_space_size=3333 yarn prisma generate
yarn run v1.22.5
$ /opt/atlassian/pipelines/agent/build/node_modules/.bin/prisma generate
Prisma schema loaded from prisma/schema.prisma
Mattias Ottosson
05/12/2021, 3:58 PMroot@627895f87344:/app# npx prisma migrate dev --name init
Environment variables loaded from prisma/.env
Prisma schema loaded from prisma/schema.prisma
Datasource "db": PostgreSQL database "opti_development", schema "public" at "db:5432"
PostgreSQL database opti_development created at db:5432
Response: Can't reach database server at `db`:`5432`
Please make sure your database server is running at `db`:`5432`.
Error: UserFacingError
Connecting to the db with psql works just fine:
root@627895f87344:/app# psql -h db -U user
Password for user user:
psql (11.11 (Debian 11.11-0+deb10u1), server 13.2)
WARNING: psql major version 11, server major version 13.
Some psql features might not work.
Type "help" for help.
user=#
Using sqlite works just fine:
root@627895f87344:/app# npx prisma migrate dev --name init
Environment variables loaded from prisma/.env
Prisma schema loaded from prisma/schema.prisma
Datasource "db": SQLite database "dev.db" at "file:./dev.db"
The following migration(s) have been created and applied from new schema changes:
migrations/
└─ 20210512160133_init/
└─ migration.sql
Your database is now in sync with your schema.
✔ Generated Prisma Client (2.22.1) to ./node_modules/@prisma/client in 389ms
schema.prisma as following
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
url = "<postgresql://user:password@db:5432/opti_development>"
}
model User {
id Int @id @default(autoincrement())
email String @unique
name String?
posts Post[]
}
model Post {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
title String
content String?
published Boolean @default(false)
viewCount Int @default(0)
author User? @relation(fields: [authorId], references: [id])
authorId Int?
}
Ist Vicente
05/12/2021, 7:42 PMIsaac Lopez
05/13/2021, 1:23 AMHào Nguyễn Đức
05/13/2021, 3:19 AMsubscriptions-transport-ws
library is not being actively maintained. It is recommended that you use the graphql-ws library instead.Hào Nguyễn Đức
05/13/2021, 3:28 AMy0on2q
05/13/2021, 6:20 AMvnadygin
05/13/2021, 9:32 AMDivlo
05/13/2021, 1:17 PMDivlo
05/13/2021, 1:22 PMCCBCodeMonkey
05/13/2021, 11:24 PMCCBCodeMonkey
05/13/2021, 11:24 PMCCBCodeMonkey
05/13/2021, 11:26 PMmodel Model {
id Int @id @default(autoincrement())
domain String? @unique
otherModels OtherModel[]
}
model OtherModule {
id Int @id @default(autoincrement())
modelId Int
modelDomain String?
model Model @relation(fields: [modelId, modelDomain], references: [id, domain])
}
CCBCodeMonkey
05/13/2021, 11:27 PMCCBCodeMonkey
05/13/2021, 11:28 PMError validating: The argument `references` must refer to a unique criteria in the related model `Model`. But it is referencing the following fields that are not a unique criteria: id, domain
CCBCodeMonkey
05/13/2021, 11:29 PMRodrigo Scomação do Nascimento
05/13/2021, 11:38 PMRodrigo Scomação do Nascimento
05/13/2021, 11:47 PMRodrigo Scomação do Nascimento
05/13/2021, 11:48 PMRodrigo Scomação do Nascimento
05/13/2021, 11:49 PMGavril
05/14/2021, 2:04 PMDaniel Garcia
05/14/2021, 2:45 PMRob Moore
05/14/2021, 5:06 PMVladimir Sanchez
05/14/2021, 5:14 PMOzgur SARIOGLAN
05/14/2021, 8:56 PMJohn McElreavey
05/14/2021, 11:17 PMSayer Tindall
05/15/2021, 12:54 AMPrisma.validator
to generate types for nested includes as such:Sayer Tindall
05/15/2021, 12:55 AMAlex Dumbreck
05/15/2021, 12:03 PM