Can you share more about your server setup, <@UAN5...
# orm-help
n
Can you share more about your server setup, @Nick? šŸ™‚
this looks like an error that is thrown by your server's application logic
h
wild guess: could be using the prisma token instead of the yoga token
šŸ’” 1
n
what is your
prisma version
? šŸ™‚
and how does your
prisma.yml
look like?
n
I'm about to zip the whole project and upload but again I have mostly copied from this page line by line https://www.howtographql.com/graphql-js/6-authentication/
prisma verison
does not affect I'm using the old one that is recommend 1.6.3
# The service name, this will be part of the endpoint of the Prisma API #service: hackernews-node # The deployment stage, this will also be part of the API endpoint #stage: dev # Points to the file that holds your data model datamodel: datamodel.graphql # You can only access the API when providing JWTs that are signed with this secret secret: mysecret123 #cluster: public-neoncharger-274/prisma-eu1 endpoint: https://eu1.prisma.sh/public-neoncharger-274/hackernews-node/dev
n
Please share your
prisma version
šŸ™‚
n
prisma/1.6.3 (windows-x64) node-v9.10.1
n
thanks!
Prisma in version
1.6.3
doesn't use
endpoint
, but uses the three properties
service
,
stage
and
cluster
in
prisma.yml
Please comment out
endpoint
and un-comment
service
,
stage
and
cluster
in
prisma.yml
šŸ™‚
n
Something is happening now
n
That sounds interesting! šŸ˜„
n
Whenever I save and run the other commands like
prisma deploy
,
node src/index.js
and
graphql playground
it changes the prisma.yml file. Everything you did before gets undone
n
How does it change the file?
n
For example
stage: dev
looks like this and when I ran the commands it looks like this
#stage: dev
n
are you running
prisma deploy
or something like
yarn prisma deploy
instead? Do you have
prisma
installed as a dev dependency?
n
prisma deploy
the package.json I just took the finished one https://github.com/howtographql/graphql-js/blob/master/package.json and did
yarn install
n
and when you run
prisma version
in an unrelated folder somewhere else in your file system, is it the same version as above?
n
just ran in the desktop directory which is a different directory from where the files are stored and I got this output
prisma/1.6.3 (windows-x64) node-v9.10.1
Do see anything wrong with the code
n
Ok, I haven't seen this before, but it sounds like a bug in the
1.6.3
version šŸ™‚ You can manually adjust
prisma.yml
for now, and once you are done with the tutorial you can switch over to the latest version šŸ™‚
n
You said something before about application logic
n
I said that in the context of a different error, which was the
invalid signature
error
n
Yeah about that error can see something wrong in the code the file that I uploaded
n
I haven't looked at the code šŸ™‚
Have you tried to follow @harmony's insight from above?
n
Yeah but what does it mean prisma token and yoga token. I'm using the token you get from running
prisma token
command and using on the authorization header
n
Did you run a query against the Node server, or directly against the Prisma API? šŸ™‚
n
The App Node server
h
there's your problem
n
Like the image

https://prisma.slack.com/files/UAN5C5FTK/FBJ2X9KMH/screenshot__55_.pngā–¾

h
the token from
prisma token
is valid for prisma, not your node server
you should have a login mutation to get a token from the node server
n
I'm using the post mutation on database dev tab(look at the image sidebar for reference) Still nothing is working
{ "data": null, "errors": [ { "message": "Cannot query field 'post' on type 'Mutation'. (line 2, column 3):\n post(url: \"www.graphql-europe.org\", description: \"Europe's biggest GraphQL conference\") {\n ^", "locations": [ { "line": 2, "column": 3 } ] } ] }
n
• database project: your Prisma API. Need to use
prisma token
to access • app project: your GraphQL Server API. Need to run
login
or
signup
(or similar, depends on your GraphQL server) to generate a valid token. Need to provide this token for mutations like
post
.
n
The thing is I have provided a token for mutation otherwise I would receive an error like this { "data": null, "errors": [ { "message": "Not authenticated", "locations": [ { "line": 2, "column": 3 } ], "path": [ "post" ] } ] }
n
You have not provided a valid token then šŸ™‚
n
Yeah "message": "invalid signature",
n
Running
signup
first ensures that the user exists, and the token is valid
n
user exist now it just spit out { "data": { "signup": { "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiJjamo1cnpibDE5OHd3MGI2NHF0NnoxYjJ1IiwiaWF0IjoxNTMwNjI3MzEyfQ.QVURhUUOASWn5tkWhltVR9-MFOe6JIHmMNqteaDVsoY", "user": { "id": "cjj5rzbl198ww0b64qt6z1b2u" } } } } but the token is still invalid
"message": "invalid signature",
n
Interesting! šŸ™‚ You can step through your JavaScript code to find the source of this problem, I don't know where it is.
h
you took that token from the json and put it into the header?
Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiJjamo1cnpibDE5OHd3MGI2NHF0NnoxYjJ1IiwiaWF0IjoxNTMwNjI3MzEyfQ.QVURhUUOASWn5tkWhltVR9-MFOe6JIHmMNqteaDVsoY
n
I ran
prisma token
on cmd then placed the token on header { "Authorization": "Bearer TOKEN" }
h
no not the token from
prisma token
the one from the mutation
n
AAAAAAAAAAAAHHHHHHHHHHHHHHHHHHHHHHHHHHH I see it now
šŸ’” 1
Jesus!!!
It works
gucci 1
šŸŽ‰ 2