简体   繁体   English

AWS Lambda - 无法确定存储用户机密的适当位置

[英]AWS Lambda - Could not determine an appropriate location for storing user secrets

We published our Net6 web API to an AWS Lambda but when we make a request it fails.我们将 Net6 web API 发布到 AWS Lambda,但是当我们发出请求时它失败了。

Status: 502 Bad Gateway状态:502 错误网关

{
  "message": "Internal server error"
}

We get this on CloudWatch:我们在 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 - line 12: Program.cs - 第 12 行:

var builder = WebApplication.CreateBuilder(args);

It's not the first time that we published an API in this way and we've never had to set this environment variable.这不是我们第一次以这种方式发布 API,而且我们从来没有设置过这个环境变量。

This's the command we use to publish the API这是我们用来发布 API 的命令

dotnet lambda deploy-function lambda-name `
  --region us-east-2 `
  --project-location $API_LOCATION `
  --profile profile `
  --function-runtime dotnet6

Any thoughts?有什么想法吗?

I just a similar error trying to deploy to AWS, for me it turned out to be that I a UserSecretsId in my csproj by mistake.我只是在尝试部署到 AWS 时遇到类似的错误,对我来说,结果是我错误地在我的 csproj 中输入了UserSecretsId The error went away when I remove this value.当我删除此值时,错误消失了。 Here is a reference on how to use UserSecrets in deployed environments https://learn.microsoft.com/en-us/as.net/core/security/app-secrets?view=as.netcore-6.0&tabs=windows这是有关如何在已部署环境中使用 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.

相关问题 来自 Lambda 的 AWS Secrets Manager 调用返回 null/none - AWS Secrets Manager call from Lambda returning null/none 使用 AWS Lambda 和 Java 的 AWS SDK 进行秘密轮换 - Secrets Rotation using AWS Lambda and the AWS SDK for Java AWS Secret Manager 轮换 Lambda 在数据库秘密轮换时超时 - AWS Secret Manager Rotation Lambda is timing out on a DB secrets rotation AWS Lambda 用于 Secrets Manager 密码轮换,为 RDS (postgres) 提供错误 - AWS Lambda for Secrets Manager Password Rotation giving Errors for RDS(postgres) AWS 参数和秘密 Lambda Extension throw 400 Bad Request - AWS Parameters and Secrets Lambda Extension throwing 400 Bad Request 无法从运行 Java 的 Lambda 检索 AWS 机密 - Unable to retrieve AWS Secrets from Lambda running Java 如何使用 Python Lambda 的 AWS Secrets Manager 缓存? - How to use AWS Secrets Manager Caching for Python Lambda? 无法向 Secrets Manager AWS CDK GoLang 授予 lambda 读取访问权限 - Not able to grant lambda read access to Secrets manager AWS CDK GoLang AWS Lambda 访问 Redshift、S3 和 Secrets Manager - AWS Lambda access to Redshift, S3 and Secrets Manager AWS 资源策略中的条件不允许 lambda 访问 Secrets Manager Secret - Condition in AWS resource policy not allowing lambda to access Secrets Manager Secret
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM