![](/img/trans.png)
[英]AWS Secrets Manager call from Lambda returning null/none
[英]AWS Lambda - Could not determine an appropriate location for storing user secrets
我们将 Net6 web API 发布到 AWS Lambda,但是当我们发出请求时它失败了。
状态:502 错误网关
{
"message": "Internal server error"
}
我们在 CloudWatch 上得到这个:
2022-09-01T10:42:07.359-03:00 Unhandled exception. System.InvalidOperationException: Could not determine an appropriate location for storing user secrets. Set the DOTNET_USER_SECRETS_FALLBACK_DIR environment variable to a folder where user secrets should be stored.
2022-09-01T10:42:07.359-03:00 at Program.<Main>$(String[] args) in C:\repository\codetria\palier\backend\backend-palier\Src\Presentation\Palier.API\Program.cs:line 12
Program.cs - 第 12 行:
var builder = WebApplication.CreateBuilder(args);
这不是我们第一次以这种方式发布 API,而且我们从来没有设置过这个环境变量。
这是我们用来发布 API 的命令
dotnet lambda deploy-function lambda-name `
--region us-east-2 `
--project-location $API_LOCATION `
--profile profile `
--function-runtime dotnet6
有什么想法吗?
我只是在尝试部署到 AWS 时遇到类似的错误,对我来说,结果是我错误地在我的 csproj 中输入了UserSecretsId
。 当我删除此值时,错误消失了。 这是有关如何在已部署环境中使用 UserSecrets 的参考https://learn.microsoft.com/en-us/as.net/core/security/app-secrets?view=as.netcore-6.0&tabs=windows
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.