0
我終於設法讓我的API進入可以將其上傳到AWS Lambda的狀態,然後每當我嘗試使用API網關對其進行測試時,都會收到以下錯誤消息。來自APIGatewayProxyFunction的空引用異常
{
"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()"
]
}
}
代碼:
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);
}
}
}
我沒有從我的啓動或登錄LambdaEntryPoint任何異常。我對AWS真的很陌生,所以我不確定還有什麼要檢查的。
對此有何意見?
是的,我開了這個bug,以及。看起來它是AWS方面的東西,與代碼相關,但我還沒有能夠隔離它。 –