Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

General Discussion

Why don't mutations persist? (GraphQL)

I'm working my way through the GraphQL tutorial. I'm on the segment about mutations, which I am led to believe are used to CHANGE data on the backend. I made a new movie with the title 'myMovie' which returned a movie id of 'movie_4' (using the Apollo Launchpad offered in the tut). I then ran the query:

query {
  allMovies {
    id
    title
  }
}

And 'myMovie' was not listed in the response and there were only 4 movies listed (should be 5, now, right?) ids: movie_0 thru movie_3

Why did it not save/persist?

Thank you for your help.

1 Answer

I believe my issues was because I had not forked the project. I tried that and then got this error message in the 'run' frame:

{
  "code": 400,
  "message": "Compilation failed: Cannot find module 'graphql-extensions'",
  "error": "Cannot find module 'graphql-extensions'",
  "stack": "Error: Cannot find module 'graphql-extensions'\n    at Function.Module._resolveFilename (module.js:325:15)\n    at Function.WebtaskModule._resolveFilename (/data/sandbox/lib/module.js:25:27)\n    at WebtaskModule.require (/data/sandbox/lib/module.js:101:39)\n    at require (/data/sandbox/lib/module.js:136:21)\n    at /data/io/cbd8ed83-f350-4dcb-a7a6-c36373447433/webtask.js:113:29\n    at Object.<anonymous> (/data/io/cbd8ed83-f350-4dcb-a7a6-c36373447433/webtask.js:257:5)\n    at WebtaskModule.compileWebtask (/data/sandbox/lib/module.js:95:34)\n    at defaultJavascriptCompiler (/data/sandbox/lib/compiler.js:119:30)\n    at defaultCompiler (/data/sandbox/lib/compiler.js:128:16)\n    at /data/sandbox/lib/compiler.js:231:17"
}

So, I still can't run a persisting mutation...