I am getting the `Your token is invalid. It might ...
# prisma-whats-new
a
I am getting the
Your token is invalid. It might have expired or you might be using a token from a different project
- error. I have run the
prisma token
command, but what exactly do I need to do with it? I have my graphql server running in it's own project and the database service in another.
So I had forgotten to define
debug: true/false
inside
new Prisma({...})
that's apparently why it happened 🙂
n
that sounds unlikely 🤔 to answer your first question, you need to pass the token as the Authorization header to your Prisma API
a
Yea I'm not sure exactly what happened, because it stopped working again after checking out a different branch, and then I nuked everything again. But it works as expected now.
n
do you have different secrets in
prisma.yml
?
on different branches
a
I did mess up something with the secrets. And I might have changed something and deployed in the wrong order I suspect
However, I am sure it is not related to a bug or anything in Prisma, graphql, Apollo etc. It has to be my own fault 😅
n
Definitely looks like something went wrong along the way 🙂 Glad you're in a good spot again.
How can we improve our documentation to be of better help in your situation?
a
Hmm not too related to this issue exactly, but I have been searching for best practice on separating the graphql server and the prisma service into two different projects as mentioned here: https://www.graph.cool/forum/t/separating-the-database-and-application-layer-using-multiple-graphql-servers-with-the-same-database-layer/2823 I have figured out most of it by now. The only part I am still unsure about, is how I would reference the generated prisma.graphql inside my server projects in other repositories. But I guess the solutions to this issue, is more related to linking files between git repos and not really a Prisma issue.
My current solution is to copy paste the
prisma.graphql
into my server repo, and that is fine my needs at this point.
n
Why are you not generating the
prisma.graphql
in your server?
a
Because I am going to have multiple servers that all need to talk to the same prisma endpoint. And I do not want to have the prisma service and multiple servers under a single git repo. But if there is a much smarter solution that I have completely missed, I would like to hear about it very much! 😄
n
Well, you can generate
prisma.graphql
in the servers individually, as part of a build step or script
a
Hmm, not sure how I would do that when my prisma service and my graphql server are separated 🤔
my structure is a bit like this currently:
Copy code
Git repo: prisma-service
+— datamodel.graphql
+— prisma.yml
+— schemas
|	+— prisma.graphql // generated on deploy
+— .env
+— .env.production
+— .env.test

Git repo: app-graphql-server
+— src
|	+— index.js
|	+— schema.graphql
|	+— imported
        |	+— prisma.graphql // copy pasted from prisma-service repo
.
.
.
`
n
graphql get-schema
is your friend 🙂
a
aha okay! How should my .graphqlconfig.yml look then? currently it's just:
Copy code
projects:
  app:
    schemaPath: "src/schema.graphql"
    extensions:
      endpoints:
        default: "<http://localhost:4000>"
n
a
But that one assumes that the schemaPath is located in the same project doesn't it?
Copy code
projects:
  app:
    schemaPath: "src/schema.graphql"
    extensions:
      endpoints:
        default: "<http://localhost:4000>"
  database:
    schemaPath: "src/generated/prisma.graphql" <-- this path
    extensions:
      prisma: database/prisma.yml