访问CDK堆栈中另一堆栈中的AWS网关资源

发布于 2025-01-22 09:07:43 字数 251 浏览 0 评论 0原文

我有一个创建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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

多像笑话 2025-01-29 09:07:43

问题在于用于创建构造的范围。将构造的范围更改为,然后效果很好。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文