I’m baaack with more api questions, I’m guessing f...
# general
h
I’m baaack with more api questions, I’m guessing for @lemon-spoon-91807… have you been able to get an IntegrationResponse working? I’m a little confused because in AWS, I expect to have to associate an integration response with the method response but there’s no argument for that 😕 I have
Copy code
const _301_method = new aws.apigateway.MethodResponse("301Method", {
    httpMethod: demo_method_get.httpMethod,
    resourceId: demo_resource_with_params.id,
    restApi: demo_api.id,
    statusCode: "301",
    responseParameters: {"method.response.header.Location": true}
});

const _301_integration = new aws.apigateway.IntegrationResponse("301Integration", {
    httpMethod: demo_method_get.httpMethod,
    resourceId: demo_resource_with_params.id,
    restApi: demo_api.id,
    statusCode: _301_method.statusCode,
    responseParameters: {"method.response.header.Location": true}
}, {dependsOn: [demo_integration_get, _301_method]});
and get the response from AWS:
Copy code
Plan apply failed: Error creating API Gateway Integration Response: BadRequestException: Invalid mapping expression specified: Validation Result: warnings : [], errors : [Invalid mapping expression specified: 1]
l
Hi there!
Reading...
I've never tried this myself
are you missing: responseTemplates?
the example shows this:
Copy code
* const myDemoIntegrationResponse = new aws.apigateway.IntegrationResponse("MyDemoIntegrationResponse", {
 *     httpMethod: myDemoMethod.httpMethod,
 *     resourceId: myDemoResource.id,
 *     // Transforms the backend JSON response to XML
 *     responseTemplates: {
 *         "application/xml": `#set($inputRoot = $input.path('$'))
 * <?xml version="1.0" encoding="UTF-8"?>
 * <message>
 *     $inputRoot.body
 * </message>
 * `,
 *     },
 *     restApi: myDemoAPI.id,
 *     statusCode: _200.statusCode,
 * });
actually, i'm guessing it might be due to:
responseParameters: {"method.response.header.Location": true}
it may not like the
: true
bit
h
ok thanks for that — I’ll let you know what works out.
uff sorry it wasn’t at all a pulumi issue - you were right in that my assignments were wacky 😕 - if anyone hits this… this works:
"method.response.header.Location": "integration.response.body.location"
and you can assert whatever value you want for .location.
l
Nice!
Looks like tihs is a common stumbling block for lots of people!
h
many things around API gateway and Lambda seem to be…