此问题可能是由于Lambda返回的Authenticator响应中包含了大量数据,超出了API Gateway缓存的限制而导致的。 解决方法是将Lambda函数的响应策略从200改为null,以防止API Gateway缓存响应,代码示例如下:
exports.handler = async (event) => {
// Your code here
return {
// Change the status code to null to prevent API Gateway caching
statusCode: null,
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
// Your response body
})
};
};
请注意,这种方法可能不适用于要求缓存Lambda响应的应用程序。在这种情况下,您可以尝试使用其他缓存方法,例如Elasticache。