简体   繁体   English

AWS api 网关中的 401 响应不一致

[英]Inconsistent 401 response in AWS api gateway

I have an API with 3 environments/stages in my AWS API Gateway (lets call them dev, staging and prod), setted up with a custom authorizer each, and in one of my GET methods I am receiving an inconsistent response from AWS when the authorization token is not valid.我有一个 API 在我的 AWS API 网关中有 3 个环境/阶段(我们称它们为 dev、staging 和 prod),分别设置了一个自定义授权人,并且在我的一种 GET 方法中,当我收到来自 AWS 的不一致响应时授权令牌无效。 For staging and prod I am receiving对于我收到的分期和产品

{
    "Message": "User is not authorized to access this resource with an explicit deny"
}

But for dev I am getting (with the lowercase 'm').但是对于我得到的开发人员(使用小写的'm')。

{
    "message": "User is not authorized to access this resource with an explicit deny"
}

This is breaking the test suite for dev so it must be fixed.这破坏了开发人员的测试套件,因此必须对其进行修复。 Rolling back to previous deployments make it work correctly, but we didn't change anything for that method (on purpose at least).回滚到以前的部署使其正常工作,但我们没有更改该方法的任何内容(至少是故意的)。

Why could this happen?为什么会发生这种情况?

Thank you in advance先感谢您

We found the solution, so for anybody interested: the Gateway Responses were returning "message" in lowercase for all responses, probably the "Message" one was hardcoded in the past for any reason and something resetted the values recently.我们找到了解决方案,因此对于任何感兴趣的人:网关响应都以小写形式返回所有响应的“消息”,可能“消息”过去因任何原因被硬编码,并且最近重置了值。 Editing it again did the work.再次编辑它完成了工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM