yeah `yarn prisma token` doesn't change anything -...
# orm-help
v
yeah
yarn prisma token
doesn't change anything - both in playground or from my app
n
Please share your setup and how you end up receiving this error message.
v
I shared up top, is there anything else you need to know?
n
This error is returned from a Prisma API that is protected by a secret, and a Query that doesn't contain the correct authorization header according to this secret.
Well, anything that helps understand why your requests end up not using a valid token.
v
The only thing I could see is that the secret changed in one place but not somewhere else - just very hard to pinpoint where because every secret is an environment var and I've nuked my containers
I've also nuked my
~/.prisma/config.yml
(I think it's deprecated anyways?)
one difference between my iMac (working) and MBP (non working) is that I don't have global prisma installed on my MBP
n
All of that is not related to the Prisma service secret.
It might be about your environment variables. But it's difficult to tell before you share more information 🙂
v
.env
Copy code
PRISMA_ENDPOINT="<http://localhost:4466>"
PRISMA_SECRET="secret123"
PRISMA_MANAGEMENT_API_SECRET="my-secret"
APP_SECRET="jwtsecret123"
index.js relevant bit
Copy code
const server = new GraphQLServer({
  typeDefs: "src/schema.graphql",
  resolvers,
  context: req => ({
    ...req,
    db: new Prisma({
      fragmentReplacements,
      typeDefs: "src/generated/prisma.graphql",
      endpoint: process.env.PRISMA_ENDPOINT,
      secret: process.env.PRISMA_SECRET,
      debug: true,
      tracing: true,
      cacheControl: true
    })
  })
});
prisma.yml
Copy code
endpoint: ${env:PRISMA_ENDPOINT}
secret: ${env:PRISMA_MANAGEMENT_API_SECRET} // tried with PRISMA_SECRET as well
datamodel: datamodel.graphql

hooks:
  post-deploy:
    - graphql get-schema --project prisma
    - graphql prepare
if there is more you need to know, let me know. I have the same env on my iMac and I nuked all of my local Docker images on all computers. The only thing not version controlled here is obv the
.env
, so rest is all identical
n
I think we discussed this before: PRISMA_API_MANAGEMENT_SECRET is not a service configuration, it's a server configuration. Remove it from prisma.yml.
basically
secret
in
prisma.yml
and
secret
in the
Prisma
constructor in
index.js
need to be the same
and also changing
secret
in
prisma.yml
is not enough, you need to deploy to update the secret.