i'm working through how to self-host prisma - but ...
# prisma-whats-new
t
i'm working through how to self-host prisma - but when I'm doing
prisma deploy
I'm getting
Copy code
Error: Whoops. Looks like an internal server error. Search your cluster logs for request ID: cluster:cluster:cjf2qrm4b000b0102ark1ccme: {"response":{"data":{"addProject":null},"errors":[{"message":"Whoops. Looks like an internal server error. Search your cluster logs for request ID: cluster:cluster:cjf2qrm4b000b0102ark1ccme","path":["addProject"],"locations":[{"line":2,"column":9}],"requestId":"cluster:cluster:cjf2qrm4b000b0102ark1ccme"}],"status":200},"request":{"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":"my-db","stage":"dev","secrets":["mysecret1234"]}}}
    at GraphQLClient.<anonymous> (/app/node_modules/graphql-request/src/index.ts:71:13)
    at step (/app/node_modules/graphql-request/dist/src/index.js:40:23)
    at Object.next (/app/node_modules/graphql-request/dist/src/index.js:21:53)
    at fulfilled (/app/node_modules/graphql-request/dist/src/index.js:12:58)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:118:7)
d
you can look in cluster logs for some more hints ...
prisma logs
t
cluster logs for non-local clusters is not implemented yet
d
I suppose you are using public cluster in a cloud?
t
actually no, my goal would be more like the digital-ocean self hosting - but I'm staging it locally in docker to see if I have the scripts right before handing it to my techops folks
d
sadly you cannot investigate those logs, so your option is to either try this against local cluster (you need Docker) or try report issue with that requestId and hope for the best 🙂
strange, you should be able to see local logs with that command then
or you can just
docker logs <containerId>
t
yeah - I can see the same in the console for the prisma service
d
prisma service is in the docker - cluster
t
Copy code
{"key":"error/handled","requestId":"cluster:cluster:cjf2s2qni0002010035ean8ui","payload":{"exception":"com.prisma.deploy.schema.InvalidProjectId: No service with name 'hercules' and stage 'dev' found","query":"\n      query($name: String! $stage: String!) {\n        project(name: $name stage: $stage) {\n          name\n          stage\n        }\n      }\n    ","variables":"{\"name\":\"hercules\",\"stage\":\"dev\"}","code":"4000","stack_trace":"com.prisma.deploy.schema.SchemaBuilderImpl.$anonfun$projectField$3(SchemaBuilder.
Copy code
{"key":"error/unhandled","requestId":"cluster:cluster:cjf2s2qu700030100y6kz3i6f","payload":{"exception":"java.sql.SQLIntegrityConstraintViolationException: (conn=15) Duplicate entry 'hercules@dev' for key 'PRIMARY'","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\":
d
now you see the reason 😉
t
Copy code
java.lang.Thread.run(Thread.java:748)","message":"(conn=15) Duplicate entry 'hercules@dev' for key 'PRIMARY'"}}
it looks like the deploy script can't find the service name/stage - and tries to create it - but when it creates it gets a duplicate entry warning -- which doesn't make sense to me
not being found seems reasonable since the DB should be clean (fresh install)
d
and if you try
prisma deploy
what happens?
eventually you can try
prisma local nuke
and
prisma local start
t
Copy code
client Token null +0ms
  client Sending query to cluster hercules +26ms
  client <http://prisma-database_1:4466/cluster> +0ms
  client
  client       query($name: String! $stage: String!) {
  client         project(name: $name stage: $stage) {
  client           name
  client           stage
  client         }
  client       }
  client      +0ms
  client { name: 'hercules', stage: 'dev' } +1ms

Creating stage dev for service hercules...  client Sending query to cluster hercules +55ms
  client <http://prisma-database_1:4466/cluster> +0ms
  client       mutation addProject($name: String! $stage: String! $secrets: [String!]) {
  client         addProject(input: {
  client           name: $name,
  client           stage: $stage
  client           secrets: $secrets
  client         }) {
  client           project {
  client             name
  client           }
  client         }
  client       }
  client        +0ms
  client { name: 'hercules', stage: 'dev', secrets: [ 'mysecret1234' ] } +1ms
 !
Error: Whoops. Looks like an internal server error. Search your cluster logs for request ID: cluster:cluster:cjf2s9cd300070100hb99559h: {"response":{"data":{"addProject":null},"errors":[{"message":"Whoops. Looks like an internal server error. Search your cluster logs for request ID: cluster:cluster:cjf2s9cd300070100hb99559h","path":["addProject"],"locations":[{"line":2,"column":9}],"requestId":"cluster:cluster:cjf2s9cd300070100hb99559h"}],"status":200},"request":{"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":"hercules","stage":"dev","secrets":["mysecret1234"]}}}
d
try what I have said please
also are you sure about
addProject
mutation? I am not aware that prisma binding would have something like that, should be
createProject
I think
t
using local works as expected
yeah - the addProject was what it reported
d
I am not sure where was what reported, but prisma API is clear on this 🙂 https://www.prismagraphql.com/docs/reference/prisma-api/mutations-ol0yuoz6go#creating-nodes
you can also check the schema in the playground just to be sure such mutation exists
n
addProject
is a mutation in the cluster API.
d
really? now I am confused 😄
t
it's in the schema from
/cluster
n
@tbrannam, this looks like your DB already contains the service name, probably due to a previous deployment that didn't go through fully.
d
oh ! that's the next level talking to cluster api, nevermind 🙂
n
the CLI talks to the cluster API to deploy projects, or show information
prisma cluster list
.
t
i'll check again - but wouldn't the first call to query { project(name) } find it if that were the case? I'm clearing the table in Graphcool/Projects to be sure of the state while debugging
n
I am not sure. you might also have discovered a bug 🙂
If you find out more about this, ideally a reproduction, I'd appreciate a bug report here: https://github.com/graphcool/prisma/.
You might find some of the resources listed under "Prisma Cluster Deployment" here useful: https://www.graph.cool/forum/t/sparkles-awesome-prisma/2878?u=nilan
t
okay fair enough