Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot use IAuthorizer to create an apigateway method #4532

Closed
gidimariastorm opened this issue Oct 16, 2019 · 2 comments
Closed

Cannot use IAuthorizer to create an apigateway method #4532

gidimariastorm opened this issue Oct 16, 2019 · 2 comments
Labels
bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.

Comments

@gidimariastorm
Copy link

gidimariastorm commented Oct 16, 2019

Hello,
I'm using python and this is my code:

auto_scaling_res=apigw_autoscaling.root.add_resource('autoscaling_update')
        get=auto_scaling_res.add_method('GET')

        auth=apigw.CfnAuthorizer(self,
        "authorizer",
        rest_api_id=apigw_autoscaling.rest_api_id,
        type="TOKEN",
        authorizer_uri="".join(["arn:aws:apigateway:",'eu-west-1',':lambda:path/2015-03-31/functions/',lamdbda_api_authorizer.function_arn,"/invocations"])
        )
 auto_scaling_res.add_method('POST', authorization_type=apigw.AuthorizationType.CUSTOM, authorizer=????)

How I can fill the authorizer paragraph? I didn't find an high level construct and the documentation is a little poor about it
Giuseppe

Reproduction Steps

Error Log

Environment

  • CLI Version : 13.1
  • Framework Version:
  • OS : MacOS
  • Language : python

Other


This is 🐛 Bug Report

@gidimariastorm gidimariastorm added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Oct 16, 2019
@rix0rrr
Copy link
Contributor

rix0rrr commented Oct 16, 2019

You can never mix CfnXxx and non-CfnXxx classes, those are not designed to work together. In this case, you are mixing RestApi and CfnAuthorizer.

Duplicate of #1402, which contains a workaround (written in TypeScript but can be ported to Python by following this guide: https://docs.aws.amazon.com/cdk/latest/guide/multiple_languages.html)

Another solution would be to use the escape hatch mechanism to inject the ID of your CfnAuthorizer into the resource after the fact.

@rix0rrr rix0rrr closed this as completed Oct 16, 2019
@gidimariastorm
Copy link
Author

@rix0rrr thanks. ok but How can I inject the ID of CfnAuthorizer here?

auto_scaling_res.add_method('POST', authorization_type=apigw.AuthorizationType.CUSTOM, authorizer=????)

the authorizer require an IAutorizher Class.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.
Projects
None yet
Development

No branches or pull requests

2 participants