By using AWS re:Post, you agree to the Terms of Use
/Application Integration/

Questions tagged with Application Integration

Sort by most recent
  • 1
  • 90 / page

Browse through the questions and answers listed below or filter and sort to narrow down your results.

0
answers
0
votes
2
views
asked a month ago

How to include context variables in AWS API-EventBridge Integration Detail body

I have an ApiGatewayv2 EventBridge-PutEvents Integration running. The POST body is sent into event bridge as the event Detail. The Integration request parameters are as below: ``` { 'Source': 'com.me.api', 'DetailType': 'ApiEvent', 'Detail': $request.body, 'EventBusName': BUS_NAME, } ``` If I post {"foo": "bar"} to the API endpoint, I end up with an event in my bus with {"foo": "bar"} as the `Detail`. So far, all straightforward. I have also enabled an authorizer on the API GW and I want to pass the context from that authorizer into the event Detail as well. I'm testing with an IAM authorizer for now, but would like to use Cognito. I can update the request parameters to change the DetailType to `$context.identity.caller` and I get my Access Key in the DetailType of the Event. This isn't what I want, but it shows that I **can** access these [context variables][1] in my integration. What I want is for that to be in the Detail though - not the DetailType. So, when I POST {"foo": "bar"} to my API GW I get an event with Detail: ``` { "body": {"foo":, "bar"}, "auth": {"user": "AAA1111ACCESSKEY"} } ``` But, I can't use anything other than `$request.body` as the Detail value in the Integration's request parameters. If I use a Detail like `{"body": $request.body}` I get an error on saving the integration - `Invalid selection expression specified: Validation Result: warnings : [], errors : [Invalid source: {"body": $request.body} specified for destination: Detail]` And, I've tried that with stringified {\"body\": $request.body} as well. How can I wrap the POST data in a key like "body" within the event's Detail, and add key/values from the context variables I get from the authorizer. Or, some other way to inject the authorizer context into my Event. Should I just give up and use a lambda to access the ApiGw context and run PutEvent? Seems defeatist! [1]: https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-logging-variables.html
0
answers
0
votes
4
views
asked 4 months ago
  • 1
  • 90 / page