Anyone know how, or where to override the `isBase6...
# aws
n
Anyone know how, or where to override the
isBase64Encoded
property on API Gateways? I’m trying to make it
false
, but not sure where to pass that in since the
eventHandler
takes a
aws.lambda.EventHandler<Request, Response>
, but I’m not sure how to pass those arguments along to the API when its pointing to a new `aws.lambda.CallbackFunction`… Thanks in advance.
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
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?
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
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.