J'ai finalement réussi à mettre mon API dans un état où je peux la télécharger sur AWS Lambda, puis j'obtiens l'erreur ci-dessous chaque fois que j'essaie d'utiliser la passerelle API pour la tester.Exception de référence nulle de 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()"
]
}
}
Code:
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);
}
}
}
Je ne reçois pas d'exceptions enregistrées de mon démarrage ou LambdaEntryPoint. Je suis vraiment nouveau à AWS, donc je ne sais pas quoi vérifier d'autre.
Des idées sur celui-ci?
Oui, j'ai ouvert ce bogue aussi bien. Il semble que ce soit quelque chose du côté AWS des choses par rapport au code, mais je n'ai pas encore pu l'isoler. –