使用Amazon API Gateway将GraphQl(AppSync)与GET REST API包装时映射请求
我想通过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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
事实证明,选择
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 vsApp Sync Data Plane
in POST. It was only made apparent via another set of eyes. Thanks to my colleague Albert Hoxha.