使用Amazon API Gateway将GraphQl(AppSync)与GET REST API包装时映射请求

发布于 2025-02-08 07:48:09 字数 579 浏览 3 评论 0原文

我想通过API网关中的AWS服务集成来创建 get 端点作为包装器,作为特定查询的现有应用程序API。

例如。 /雇员/{ID}/居住环境

在映射模板中,我将查询放置

{"query":"query MyQuery {getEmployeeDetails(id: \"$method.request.path.id\") {address {country}}}"}

在没有正确的日志的情况下,我将获得500个内部服务器错误。

当我创建一个 post 端点时,我将上述主体作为请求将主体传递给我的REST API,它可以起作用。

在执行日志中,我看到了转换后的endpoint请求主体完全相同的内容:

为了获得正确的日志,我尝试获得$ context.ertor.error.message$ context.integrationerrormessage,但我没有任何详细信息。

有人可以告诉我我做错了什么或如何更好地调试吗?

I want to create a GET endpoint as a wrapper over an existing App Sync api for a specific query using AWS Service integration in API Gateway.

Eg. /employee/{id}/residenceCountry

In the mapping template I put the query as

{"query":"query MyQuery {getEmployeeDetails(id: \"$method.request.path.id\") {address {country}}}"}

However, I am getting a 500 Internal server error with no proper logs.

When I create a POST endpoint such that I pass the above body as request body to my rest api with passthrough, it works.

In the execution logs I see the exact same content for Endpoint request body after transformations:

In order to get the proper logs I tried getting $context.error.message and $context.integrationErrorMessage but I do not get any details.

Could someone please tell what I could be doing wrong or how to debug this better?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

岛徒 2025-02-15 07:48:09

事实证明,选择app sync作为get vs vs vs 应用程序同步数据平面中的AWS服务是一个非常愚蠢的错误。它仅通过另一套眼睛才明显。感谢我的同事Albert Hoxha。

It turned out to be a very silly mistake of selecting App Sync as AWS Service in GET vs App Sync Data Plane in POST. It was only made apparent via another set of eyes. Thanks to my colleague Albert Hoxha.

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