yndlingsfar / serverless-openapi-integration-helper

The plugin separates x-amazon-apigateway extension syntax from your openapi3 files
MIT License
6 stars 5 forks source link

Unable to use stageVariables from integrations #12

Open henhal opened 2 years ago

henhal commented 2 years ago

I followed the example regarding usage of stageVariables from integrations:

      x-amazon-apigateway-integration:
        type: aws_proxy
        passthroughBehavior: when_no_match
        httpMethod: POST
        uri: ${stageVariables.LambdaArn}

But when I deploy, I get this:

An error occurred: ApiGatewayRestApi - Errors found during import:
    Unable to put integration on 'POST' for resource at path '/test': Invalid ARN specified in the request

I've verified that LambdaArn is assigned as a stage variable.

If changing my integration to an absolute value, like arn:aws:apigateway:eu-west-1:lambda:path/2015-03-31/functions/arn:aws:lambda:eu-west-1:xxxxxyyyyzzz:function:test-api-dev/invocations, it works. And the stage variable has this exact value.

Any idea why referencing stageVariables does not work?

yndlingsfar commented 2 years ago

Hi henhal, currently only http and http_proxy is supported

mefengl commented 1 year ago

Hello @henhal, I noticed that you had a need to use something like uri: ${stageVariables.LambdaArn} in the past. Have you found a solution to this? I am currently facing the same issue and am looking for a way to resolve it. Any updates or suggestions you have would be greatly appreciated.

henhal commented 1 year ago

@mefengl What works for me is something like this:

x-amazon-apigateway-integration: 
  type: aws_proxy 
  httpMethod: POST 
  uri: arn:aws:apigateway:eu-west-1:lambda:path/2015-03-31/functions/arn:aws:lambda:eu-west-1:583329677394:function:${stageVariables.LambdaName}/invocations

It didn't work when putting that entire string S a stage variable, only when building it like this, keeping everything up until function: outside the variable. No idea why.