Skip to content

Commit 70e3b2f

Browse files
authored
fix: GraphQL query endpoint errors (#688)
1 parent 2409bc7 commit 70e3b2f

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

aws-node-graphql-api-with-dynamodb/README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,11 @@ const schema = new GraphQLSchema({
5757

5858
// We want to make a GET request with ?query=<graphql query>
5959
// The event properties are specific to AWS. Other providers will differ.
60-
module.exports.query = (event, context, callback) => graphql(schema, event.queryStringParameters.query)
60+
module.exports.query = (event, context, callback) =>
61+
graphql({
62+
schema,
63+
source: event.queryStringParameters.query
64+
})
6165
.then(
6266
result => callback(null, {statusCode: 200, body: JSON.stringify(result)}),
6367
err => callback(err)

aws-node-graphql-api-with-dynamodb/handler.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,10 @@ const schema = new GraphQLSchema({
7777
// We want to make a GET request with ?query=<graphql query>
7878
// The event properties are specific to AWS. Other providers will differ.
7979
module.exports.query = (event, context, callback) =>
80-
graphql(schema, event.queryStringParameters.query)
80+
graphql({
81+
schema,
82+
source: event.queryStringParameters.query
83+
})
8184
.then(
8285
result => callback(null, { statusCode: 200, body: JSON.stringify(result) }),
8386
err => callback(err)

0 commit comments

Comments
 (0)