i get object. but the pact contract expects a stringified body for verification. is this an aws integration behavior or a genesys cloud specific header issue?
Make sure you check your Lambda’s “Payload format version” in the trigger configuration. AWS automatically parses JSON for v2.0 triggers, so you must stringify the event before passing it to your Pact consumer for verification.
Have you tried setting payloadFormatVersion: '2.0' in the Lambda trigger config?
AWS v2.0 events parse JSON automatically, so you get an object instead of a string. The suggestion above is correct; you need to handle the parsed object in your Pact contract or revert to v1.0 if you strictly need the raw string body.
trying to understand why my lambda function receives the payload directly as an object instead of a stringified json blob.
AWS API Gateway v2.0 parses the body automatically. Do not rely on event.body being a string. Access event.body directly as an object or use JSON.parse() only if you are stuck on v1.0 triggers.
// v2.0 trigger: event.body is already a parsed object
const payload = event.body;
The documentation actually says… “For HTTP API, the body is passed as a JSON object in the event parameter,” so you should handle the parsed object directly in your handler rather than expecting a raw string.