'Accessing the AWS gateway resource in another stack in cdk stack
I have a stack where an api gateway resource is created. I have a construct under this stack from where i need to create a method to the above resource. I tried passing the resource as the props to the construct. But it throws error as
throw new Error(
${construct.constructor?.name ?? 'Construct'} at '${Node.of(construct).path}' should be created in the scope of a Stack, but no Stack found);
Any idea on creating and passing the aws api gateway resource inside a stack and pass it to the construct or another stack.
Solution 1:[1]
The issue is with the scope that is used to create the construct. Changed the scope of the construct to this then it worked fine.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Ragupathy J |
