You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

关于APIGatewayCustomAuthorizerContextOutput仅支持字符串值的疑问

关于APIGatewayCustomAuthorizerContextOutput仅支持字符串值的疑问

我们在开发C# Lambda授权器时,会返回APIGatewayCustomAuthorizerResponse对象,其中的Context属性类型为APIGatewayCustomAuthorizerContextOutput,我们原本打算通过这个属性给授权器前置的“API Lambda”传递上下文数据。

但实际使用时遇到了问题:虽然APIGatewayCustomAuthorizerContextOutput继承了Dictionary<String, Object>,但我们根本不能往里面存放Object类型的值——这个字典只能接受字符串类型的内容。

我在API Gateway的CloudWatch日志里看到了如下错误:

Execution failed due to configuration error: Invalid JSON in response: Cannot deserialize value of type java.lang.String from Object value (token JsonToken.START_OBJECT)

我现在特别疑惑:既然不允许使用真正的Object值,那APIGatewayCustomAuthorizerContextOutput为什么要继承Dictionary<String, Object>呢?

备注:内容来源于stack exchange,提问作者Tom Baxter

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.17 11:49:29