return fields in lambda resolver
Appsync is not sending query/mutation return fields list in lambda resolver event, Getting this JSON:
Logs of lambda resolver event:
{ "typeName": "Query", "fieldName": "getSalonById", "arguments": { "salonId", "currentLocation" }, "identity": { }, "defaultAuthStrategy": "ALLOW" }, "source": null, "request": { }, "prev": { "result": {} } }
Appsync Query
export const getSalonById = /* GraphQL */ " query GetSalonById($salonId: String, $currentLocation: geoCoords) { getSalonById(salonId: $salonId, currentLocation: $currentLocation) { _id name } } "
I want list of required fields(_id, name) but not getting it in my lambda resolver.
It must be in event.info (doc), where event is a first argument of lambda
see here to learn more about the info object: https://aws.amazon.com/blogs/mobile/appsync-and-the-graphql-info-object/
If you use a Direct Lambda Resolver, the info object is sent automatically to your Lambda function