aws-appsync-community icon indicating copy to clipboard operation
aws-appsync-community copied to clipboard

return fields in lambda resolver

Open raghuchaharsqm opened this issue 4 years ago • 2 comments

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.

raghuchaharsqm avatar Oct 07 '21 10:10 raghuchaharsqm

It must be in event.info (doc), where event is a first argument of lambda

kyptov avatar Oct 11 '21 05:10 kyptov

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

onlybakam avatar Feb 07 '22 23:02 onlybakam