Aws-lambda-dotnet: Amazon.Lambda.AspNetCoreServer different behaviour on local and AWS

Created on 28 Feb 2018  ·  7Comments  ·  Source: aws/aws-lambda-dotnet

Hello AWS Team,

There is some problem with your implementation of LambdaEntryPoint, behavior is diffferent than this which is on LocalEntryPoint. To recreate this case you need to made CustomAttribute:

```
public class CustomAttribute : ActionFilterAttribute
{
public override void OnActionExecuted(ActionExecutedContext actionExecutedContext)
{
HttpResponse response = actionExecutedContext.HttpContext.Response;
LambdaLogger.Log("Test "+ response.StatusCode+ " "+ (response != null).ToString() +" " +
response.IsSuccessStatusCode().ToString()+ " " + (actionExecutedContext.Result != null).ToString());

        base.OnActionExecuted(actionExecutedContext);
    }
}

```

If you test this CustomAttribute with localEntry you will see that StatusCode is set, but when you debug this on AWS you will get 0 cause something work in different order. I investigate this issue with OData team here: OData/WebApi#1227

A bug modullambda-client-lib queued

Most helpful comment

@normj Any plans to fix this?

All 7 comments

I was able to reproduce the issue but not sure yet why it is happening but I'll keep investigating.

Some news in this topic?

@normj, I am also having a similar issue with this custom action filter

using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;

namespace Infrastructure
{
    public class ValidateModelAttribute : ActionFilterAttribute, IOrderedFilter
    {
        public ValidateModelAttribute()
        {
            Order = 100;
        }
        public override void OnActionExecuting(ActionExecutingContext context)
        {
            if (!context.ModelState.IsValid)
            {
                context.Result = new BadRequestObjectResult(context.ModelState);
            }
        }
    }
}

It works fine locally and returns validation errors and terminates the request, but it doesn't execute when deployed to AWS Lambda.

This bug still occur, if there is some plan to repair it?

@normj Any plans to fix this?

What's the latest on this? It's been more than a year since the last comment was added. @NGL321 , can you provide an update?

Hey @julealgon,

Sorry for the label and go. We are presently aware of this bug and planning to fix it, but unfortunately I cant give you a more concrete timeline at the moment as it is not in the immediate fix plan.
If this is blocking, you are welcome to submit a pull request to fix and we will review it as soon as able. Alternatively, keep bumping this, and I will make sure it gets attention as soon as feasible (the more people who request a fix, the higher we can move it in our priorities) 😉

😸 😷

Was this page helpful?
0 / 5 - 0 ratings

Related issues

matsola picture matsola  ·  4Comments

briancullinan picture briancullinan  ·  7Comments

ShaneGMamet picture ShaneGMamet  ·  3Comments

JustinGrote picture JustinGrote  ·  5Comments

Kralizek picture Kralizek  ·  3Comments