thank you for the post. it is very helpful but when you have lambda and api gateway in different stacks, you will get a cyclic reference error. and is there any solution for this one? or think about another example, you are passing api-gateway stack as a resource to lambda constructor as you want to create multiple lambdas in any other stack. for this example where this requestValidation should be added.
SchemaValidator is a property/setting of the APIGateway not of the Lambda, so having a Lambda in a different stack, makes no difference.
In the stacks where the lambda is defined there will be no mention of the gateway api. In the stack where you create the gateway api, yes, you need to reference/import you lambda in order to create the lambdaIntegration.
new apigateway.LambdaIntegration(myLambda)
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
thank you for the post. it is very helpful but when you have lambda and api gateway in different stacks, you will get a cyclic reference error. and is there any solution for this one? or think about another example, you are passing api-gateway stack as a resource to lambda constructor as you want to create multiple lambdas in any other stack. for this example where this requestValidation should be added.
SchemaValidator is a property/setting of the APIGateway not of the Lambda, so having a Lambda in a different stack, makes no difference.
In the stacks where the lambda is defined there will be no mention of the gateway api. In the stack where you create the gateway api, yes, you need to reference/import you lambda in order to create the lambdaIntegration.
new apigateway.LambdaIntegration(myLambda)