Don*_*ain 6 c# amazon-web-services aws-lambda aws-api-gateway asp.net-core
我终于设法让我的 API 进入可以将其上传到 AWS Lambda 的状态,然后每当我尝试使用 API Gateway 测试它时,都会收到以下错误。
{
"errorType": "AggregateException",
"errorMessage": "One or more errors occurred. (Object reference not set to an instance of an object.)",
"stackTrace": [
"at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)",
"at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)",
"at lambda_method(Closure , Stream , Stream , ContextInfo )"
],
"cause": {
"errorType": "NullReferenceException",
"errorMessage": "Object reference not set to an instance of an object.",
"stackTrace": [
"at Amazon.Lambda.AspNetCoreServer.APIGatewayProxyFunction.MarshallRequest(InvokeFeatures features, APIGatewayProxyRequest apiGatewayRequest)",
"at Amazon.Lambda.AspNetCoreServer.APIGatewayProxyFunction.<FunctionHandlerAsync>d__12.MoveNext()"
]
}
}
Run Code Online (Sandbox Code Playgroud)
代码:
public class LambdaEntryPoint : Amazon.Lambda.AspNetCoreServer.APIGatewayProxyFunction
{
protected override void Init(IWebHostBuilder builder)
{
try
{
builder
.UseContentRoot(Directory.GetCurrentDirectory())
.UseStartup<Startup>()
.UseApiGateway();
}
catch (Exception ex)
{
LambdaLogger.Log("Exception throw in LambdaEntryPoint: " + ex);
}
}
}
Run Code Online (Sandbox Code Playgroud)
我没有从我的 Startup 或 LambdaEntryPoint 记录任何异常。我对 AWS 还很陌生,所以我不知道还要检查什么。
对这个有什么想法吗?
这可能与 AWS 的某人与其他人在 AWS github 存储库上针对 AWS .NET Lambda 集成解决的问题相同: https://github.com/aws/aws-lambda-dotnet/issues/168
| 归档时间: |
|
| 查看次数: |
5565 次 |
| 最近记录: |