This one is very frustrating, since AWS api gateway by default seems to be setting base64 encoding to true by default, and expects params for POSTs also. Not sure if i’m more frustrated with the awsx sdk, pulumi, or api gateway on this one. but this shouldn’t be so difficult to override arguments like it is in this particular case.
f
future-diamond-31373
08/20/2020, 8:22 AM
Yeah I've found that some of the nooks and crannies are pretty inflexible for awsx since it's more of an extension library. Is decoding the event.body an option?
future-diamond-31373
08/20/2020, 8:26 AM
maybe something like this in your lambda
Copy code
let payloadString = event.body;
if (event.isBase64Encoded) {
// Decode base64 encoded string
payloadString = Buffer.from(payloadString, 'base64').toString('binary');
}
// Parse payload string into an object
const payload = JSON.parse(payloadString);
It doesn't get override the property, but at least it makes the encoded event.body usable
👍 1
n
nice-airport-15607
08/20/2020, 3:13 PM
yeah, basically have to do what you suggest with the buffer… thx for the response. otherwise, there are mapping templates that can be used also, but haven’t looked into that at all.
No matter how you like to participate in developer communities, Pulumi wants to meet you there. If you want to meet other Pulumi users to share use-cases and best practices, contribute code or documentation, see us at an event, or just tell a story about something cool you did with Pulumi, you are part of our community.