apollographql / fullstack-tutorial

🚀 The Apollo platform tutorial app

Home Page:https://www.apollographql.com/docs/tutorial/introduction.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Have issue with Mutation

kian92 opened this issue · comments

I was following the tutorial for Apollo Server

I stuck at Step 3, Write your graph's resolvers.

When I run mutations in the playground:

mutation LoginUser {
login(email: "daisy@apollographql.com")
}

I received the error messages like :

{
"errors": [
{
"message": "Cannot read property 'findOrCreateUser' of undefined",
"locations": [
{
"line": 30,
"column": 3
}
],
"path": [
"login"
],
"extensions": {
"code": "INTERNAL_SERVER_ERROR",
"exception": {
"stacktrace": [
"TypeError: Cannot read property 'findOrCreateUser' of undefined",
" at login (C:\laragon\www\fullstack-tutorial\start\server\src\resolvers.js:67:46)",
" at field.resolve (C:\laragon\www\fullstack-tutorial\start\server\node_modules\graphql-extensions\dist\index.js:140:26)",
" at resolveFieldValueOrError (C:\laragon\www\fullstack-tutorial\start\server\node_modules\graphql\execution\execute.js:467:18)",
" at resolveField (C:\laragon\www\fullstack-tutorial\start\server\node_modules\graphql\execution\execute.js:434:16)",
" at C:\laragon\www\fullstack-tutorial\start\server\node_modules\graphql\execution\execute.js:244:18",
" at C:\laragon\www\fullstack-tutorial\start\server\node_modules\graphql\jsutils\promiseReduce.js:23:10",
" at Array.reduce ()",
" at promiseReduce (C:\laragon\www\fullstack-tutorial\start\server\node_modules\graphql\jsutils\promiseReduce.js:20:17)",
" at executeFieldsSerially (C:\laragon\www\fullstack-tutorial\start\server\node_modules\graphql\execution\execute.js:241:37)",
" at executeOperation (C:\laragon\www\fullstack-tutorial\start\server\node_modules\graphql\execution\execute.js:219:55)",
" at executeImpl (C:\laragon\www\fullstack-tutorial\start\server\node_modules\graphql\execution\execute.js:104:14)",
" at Object.execute (C:\laragon\www\fullstack-tutorial\start\server\node_modules\graphql\execution\execute.js:64:35)",
" at C:\laragon\www\fullstack-tutorial\start\server\node_modules\apollo-server-core\dist\requestPipeline.js:239:46",
" at Generator.next ()",
" at C:\laragon\www\fullstack-tutorial\start\server\node_modules\apollo-server-core\dist\requestPipeline.js:7:71",
" at new Promise ()",
" at __awaiter (C:\laragon\www\fullstack-tutorial\start\server\node_modules\apollo-server-core\dist\requestPipeline.js:3:12)",
" at execute (C:\laragon\www\fullstack-tutorial\start\server\node_modules\apollo-server-core\dist\requestPipeline.js:218:20)",
" at Object. (C:\laragon\www\fullstack-tutorial\start\server\node_modules\apollo-server-core\dist\requestPipeline.js:156:42)",
" at Generator.next ()",
" at fulfilled (C:\laragon\www\fullstack-tutorial\start\server\node_modules\apollo-server-core\dist\requestPipeline.js:4:58)"
]
}
}
}
],
"data": {
"login": null
}
}

Anyone have experiences when doing the tutorial for Apollo Server?

Its my mistake. I found the fix already