serverless / serverless/examples

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

Open
#553 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
11.5k
Forks
4.4k
Avg merge
2h 55m
Merged PRs (30d)
3

Description

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Clone the aws-node-typescript-apollo-lambda example, follow the README environment setup, run npm run dev, and reproduce the failure at http://localhost:3000/dev/graphql. Investigate the example's resolver configuration and determine what prevents the Mutation resolver from being treated as an object; done means the GraphQL Playground loads without the reported error.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, graphql, node.js, typescript
Domain
api, backend, cloud
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.