serverless / examples

Serverless Examples – A collection of boilerplates and examples of serverless architectures built with the Serverless Framework on AWS Lambda, Microsoft Azure, Google Cloud Functions, and more.
https://www.serverless.com/examples/
Other
11.45k stars 4.47k forks source link

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

Open michaelmerrill opened 4 years ago

michaelmerrill commented 4 years ago

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