examples icon indicating copy to clipboard operation
examples copied to clipboard

Mutation was defined in resolvers, but it's not an object

Open michaelmerrill opened this issue 3 years ago • 0 comments

I've cloned the aws-node-typescript-apollo-lambda example and I cannot get the playground to work. I get the following error.

Error: Mutation was defined in resolvers, but it's not an object

To recreate the issue:

  1. clone the repo
  2. install deps
  3. follow steps for env variables in the README
  4. npm run dev
  5. visit graphql playground at http://localhost:3000/dev/graphql
  6. see console for error.

Here is the console output:

$ serverless offline --apiKey your-api-key-that-is-at-least-characters-long
Serverless: DOTENV: Loading environment variables from .env:
Serverless:      - APOLLO_LAMBDA_KEY
Serverless:      - NODE_ENV
Serverless: Compiling with Typescript...
Serverless: Using local tsconfig.json
Serverless: Typescript compiled.
Serverless: Watching typescript files...
offline: Starting Offline: dev/us-east-1.
offline: Offline [http for lambda] listening on http://localhost:3002

   ┌───────────────────────────────────────────────────────────────────────────┐
   │                                                                           │
   │   POST | http://localhost:3000/dev/graphql                                │
   │   POST | http://localhost:3000/2015-03-31/functions/graphql/invocations   │
   │   GET  | http://localhost:3000/dev/graphql                                │
   │   POST | http://localhost:3000/2015-03-31/functions/graphql/invocations   │
   │                                                                           │
   └───────────────────────────────────────────────────────────────────────────┘

offline: [HTTP] server ready: http://localhost:3000 🚀
offline: 
offline: Enter "rp" to replay the last request
Serverless: Compiling with Typescript...
Serverless: Typescript compiled.

offline: GET /dev/graphql (λ: graphql)
offline: (λ: graphql) RequestId: ckf1whi0h0002gzxg0ks9b6c9  Duration: 251.31 ms  Billed Duration: 300 ms

offline: POST /dev/graphql (λ: graphql)
offline: Failure: Mutation was defined in resolvers, but it's not an object
Error: Mutation was defined in resolvers, but it's not an object

michaelmerrill avatar Sep 14 '20 02:09 michaelmerrill