There is something like a prisma nuke command.I am...
# prisma-whats-new
s
There is something like a prisma nuke command.I am pretty sure it is actually called prisma nuke šŸ˜‰
d
prisma local nuke
šŸ™‚
f
Yeah I tried that
Now everything is broken 😢
I'm getting this error now... I phrased the question so simply because I thought I did something wrong šŸ˜ž
Copy code
{
  "data": null,
  "errors": [
    {
      "message": "GraphQL Error (Code: 200)",
      "locations": [],
      "path": [
        "posts"
      ]
    }
  ]
}
d
Yes, this means that you prisma service is not running anymore, since, it was nuked. You might want to redeploy the service using
prisma deploy
f
I've done that. Also ssh'ed into my server and ran
Copy code
docker ps
and it looks like everything is running. Deploying service
sakura
to stage
dev
on cluster
public-freechiller-471/sakura
127ms Service is already up to date. Hooks: Checking, if schema file changed 486ms
d
aha! in that case this issue is different.. as you can see that your service is deployed on public cluster and not local. Nuke should not have had any impact. Can you cross check the service link in
src/index.js
and also check cluster, stage in
database/prisma.yml
?
f
Yeah thats what I was thinking the nuke may have messed up something on my cluster src/index.js
Copy code
db: new Prisma({
      typeDefs: 'src/generated/prisma.graphql',
      endpoint: process.env.PRISMA_ENDPOINT, // the endpoint of the Prisma DB service (value is set in .env)
      secret: process.env.PRISMA_SECRET, // taken from database/prisma.yml (value is set in .env)
      debug: true, // log all GraphQL queries & mutations
    }),
prisma.yml
Copy code
# the name for the service (will be part of the service's HTTP endpoint)
service: sakura

# the cluster and stage the service is deployed to
stage: ${env:PRISMA_STAGE}

# to disable authentication:
# disableAuth: true
secret: ${env:PRISMA_SECRET}

# the file path pointing to your data model
datamodel: datamodel.graphql

# seed your service with initial data based on seed.graphql
seed:
  import: seed.graphql

cluster: ${env:PRISMA_CLUSTER}
d
Can you do an
echo $PRISMA_ENDPOINT
in CLI? or search for it in codebase?
Also, please share
prisma.yml
šŸ™‚
f
looks like this
Copy code
PRISMA_ENDPOINT="<http://redacted:4466/public-x-471/sakura/dev>"
PRISMA_CLUSTER="public-x-471/sakura"
PRISMA_STAGE="dev"
prisma.yml
Copy code
prisma.yml
```# the name for the service (will be part of the service's HTTP endpoint)
service: sakura

# the cluster and stage the service is deployed to
stage: ${env:PRISMA_STAGE}

# to disable authentication:
# disableAuth: true
secret: ${env:PRISMA_SECRET}

# the file path pointing to your data model
datamodel: datamodel.graphql

# seed your service with initial data based on seed.graphql
seed:
  import: seed.graphql

cluster: ${env:PRISMA_CLUSTER}
```
d
So, if you want to try this on local, you can change the cluster to local in place of the shared one! Does that work?
f
It works locally
yes
d
so, is this resolved for now? or do you want to sort out the public cluster as well?
f
I would like to figure out why my public cluster is broken. I tried to isolate the issue by reinstalling everything. no avail.
But locally it is resolved
d
Well, I am not sure about that one but from the looks of it your PRISMA_ENDPOINT does not look like a valid URL to me, but I am not a 100% sure about this one!
what does
prisma info
output for you?
f
Copy code
🐁 . . . prisma info
Service Name: sakura

  dev (cluster: `sakura`)

    HTTP:       <http://hidden-ip:4466/public-freechiller-471/sakura/dev>
    Websocket:  <ws://hidden-ip:4466/public-freechiller-471/sakura/dev>
d
Try to replace cluster endpoint with HTTP: http://hidden-ip:4466/public-freechiller-471/sakura/dev and try?
f
Im not sure what you mean
what do I replace it with??
d
In prisma.yml replace PRISMA_ENDPOINT="http://redacted:4466/public-x-471/sakura/dev" with PRISMA_ENDPOINT="http://hidden-ip:4466/public-freechiller-471/sakura/dev" Not sure if this will work but please give it a shot!
oh!
it is the same IP
got it!
my bad!
f
Yupp haha
Ots the same
sorry
d
prisma info and prisma.yml contain the same http endpoint right? can you try to open it directly in browser?
f
Yup
it works
d
playground works fine? can you try a query on that?
f
Copy code
{
  "code": 3015,
  "requestId": "api:api:c05o0126v98z1v75",
  "error": "Your token is invalid. It might have expired or you might be using a token from a different project."
}
query doesnt work
I get this issue
This is super weird
Never had this issue
d
Yes, this is because prisma has authentication! you can add http header at the bottom! let me find a link that explains this
f
prisma token
d
yup.. you need to send
Authorization: Bearer <token>
in http headers
f
Copy code
{
  "Authentication": "Bearer token"
}
yup
d
So, that is not working?
even with correct token? I think token is generated against local cluster?
f
Copy code
{
  "code": 3016,
  "requestId": "api:api:cjdq5tqkw005v0126lm5rbx63",
  "error": "Project not found: 'public-freechiller-471~sakura@dev'"
}
d
oh my!
try the
disableAuth: true
just for testing purpose?
f
That doesn't work, this key just goes into the setting?
d
Look for "Prisma API requires authentication" in this article https://blog.graph.cool/tutorial-how-to-build-a-graphql-server-with-graphql-yoga-6da86f346e68 It goes as a field in prisma.yml file
f
Aah
d
Was that an aha! or aaaaarrggghh šŸ˜…
f
More like frustration but this helps
haha
d
šŸ‘ Let me know your findings, let's explore it and try to figure it out šŸ™‚
f
I figured it out ā¤ļø
It was a mismatch with my cluster in my .prisma/config file
😢
Wow
Thanks for your help @divyendu
šŸ‘ 1
d
šŸ’š I had gone for a tiny šŸŗ session but awesome to hear that it is solved for you.. happy to help šŸ™‚