访问CDK堆栈中另一堆栈中的AWS网关资源
我有一个创建API网关资源的堆栈。我在此堆栈下有一个构造,需要在其中创建上述资源的方法。我尝试将资源作为道具传递给构造。但它会引发错误
投掷新错误(
$ {construct.constructor?.name ??'construct'} at'$ {node.of(struct)。堆栈找到
);
关于创建和传递AWS API网关资源的任何想法,并将其传递到构造或其他堆栈中。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(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.