clever-market-90633
02/02/2023, 5:15 PMAPI Gateway Integration: BadRequestException: Invalid ARN specified in the request
. Can anyone help me understand what am I doing wrong? This is the code:
const eventsResourcePOSTMethodIntegration = new aws.apigateway.Integration(
"eventsResourcePOSTMethodIntegration",
{
restApi: restApi,
resourceId: eventsResource.id,
httpMethod: eventsResourcePOSTMethod.httpMethod,
type: "AWS",
credentials: apiGatewayRole.arn,
passthroughBehavior: "NEVER",
requestParameters: {
"integration.request.header.X-Amz-Target": "'AWSEvents.PutEvents'",
"integration.request.header.Content-Type": "'application/x-amz-json-1.1'"
},
uri: `arn:aws:apigateway:${region}:events:action/PutEvents`,
integrationHttpMethod: "POST",
requestTemplates: {
"application/json": `#set($inputRoot = $input.path('$'))
{
"Entries": [
#foreach($item in $inputRoot)
{
"Detail": $input.json("$[$foreach.index]"),
"DetailType": "$item.eventType",
"EventBusName": "test",
"Source": "wrike.apigateway"
}#if($foreach.hasNext),#end
]
}
#end`
}
},
{
dependsOn: [
restApi,
eventsResource,
eventsResourcePOSTMethod,
apiGatewayRole
]
}
);
miniature-musician-31262
02/02/2023, 5:31 PMuri
property? Where is ${region}
coming from?clever-market-90633
02/02/2023, 5:31 PMconst region = config.get("aws:region");
pulumi.interpolate
miniature-musician-31262
02/02/2023, 5:33 PMregion
, you’ll get something like undefined
clever-market-90633
02/02/2023, 5:38 PMpulumi up
fail on other resources that use region
too?miniature-musician-31262
02/02/2023, 5:45 PM@pulumi/aws
) will generally read that value correctly, whether from your stack config file or from your shell environment, so your deployment will generally be fine. But if you want to use that value within your program code as well, you need to read it by passing the “namespace” (in this case aws
) to a new Config instance and reading the region
setting with that instance.clever-market-90633
02/02/2023, 5:46 PMconfig.get
to config.requeir
and pulumi up
failed... thank you very much for the helpminiature-musician-31262
02/02/2023, 5:47 PMundefined
when you try to use it in a string (for that ARN), but you should be able to use the config thing I mentioned to address that.clever-market-90633
02/02/2023, 5:51 PMminiature-musician-31262
02/02/2023, 5:59 PM