Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error occurs with AWS Lambda when sending non-standard APIGatewayProxyRequest json. #2528

Closed
jaffinito opened this issue Jun 6, 2024 · 1 comment · Fixed by #2529
Closed
Labels
bug Something isn't working

Comments

@jaffinito
Copy link
Member

Description
Lambda function: APIGatewayProxyRequest

When sending the following json to an APIGatewayProxyRequest lambda function, it fails with System.ArgumentNullException errors.

{
  "httpMethod": "GET",
  "path": "/test",
  "body": "{\"Name\":\"John\"}"
}

Exceptions:

2024-06-06 15:21:33,716 NewRelic   WARN: [pid: 16, tid: 9] Unexpected exception in AddEventTypeAttributes(). Event type APIGatewayProxyRequest had an inputObject of type Amazon.Lambda.APIGatewayEvents.APIGatewayProxyRequest. Exception: System.ArgumentNullException: Value cannot be null. (Parameter 'parameters')
   at NewRelic.Agent.Core.Transactions.Transaction.SetRequestParameters(IEnumerable`1 parameters)
   at System.Dynamic.UpdateDelegates.UpdateAndExecuteVoid2[T0,T1](CallSite site, T0 arg0, T1 arg1)
   at NewRelic.Agent.Extensions.Lambda.LambdaEventHelpers.SetWebRequestProperties(IAgent agent, ITransaction transaction, Object webReqEvent)
   at System.Dynamic.UpdateDelegates.UpdateAndExecuteVoid4[T0,T1,T2,T3](CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3)
   at NewRelic.Agent.Extensions.Lambda.LambdaEventHelpers.AddEventTypeAttributes(IAgent agent, ITransaction transaction, AwsLambdaEventType eventType, Object inputObject)
2024-06-06 15:21:33,734 NewRelic  ERROR: [pid: 16, tid: 9] Tracer invocation error
System.ArgumentNullException: Value cannot be null. (Parameter 'parameters')
   at NewRelic.Agent.Core.Transactions.Transaction.SetRequestParameters(IEnumerable`1 parameters)
   at System.Dynamic.UpdateDelegates.UpdateAndExecuteVoid2[T0,T1](CallSite site, T0 arg0, T1 arg1)
   at NewRelic.Agent.Extensions.Lambda.LambdaEventHelpers.SetWebRequestProperties(IAgent agent, ITransaction transaction, Object webReqEvent)
   at System.Dynamic.UpdateDelegates.UpdateAndExecuteVoid4[T0,T1,T2,T3](CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3)
   at NewRelic.Agent.Extensions.Lambda.LambdaEventHelpers.AddEventTypeAttributes(IAgent agent, ITransaction transaction, AwsLambdaEventType eventType, Object inputObject)
   at NewRelic.Providers.Wrapper.AwsLambda.HandlerMethodWrapper.BeforeWrappedMethod(InstrumentedMethodCall instrumentedMethodCall, IAgent agent, ITransaction transaction)
   at NewRelic.Agent.Core.Wrapper.WrapperService.BeforeWrappedMethod(Type type, String methodName, String argumentSignature, Object invocationTarget, Object[] methodArguments, String tracerFactoryName, String metricName, UInt32 tracerArguments, UInt64 functionId)
   at NewRelic.Agent.Core.AgentManager.GetTracerImpl(String tracerFactoryName, UInt32 tracerArguments, String metricName, String assemblyName, Type type, String typeName, String methodName, String argumentSignature, Object invocationTarget, Object[] arguments, UInt64 functionId)

The problem appears to be in this method on line 295.

Expected Behavior
It just works, or at least an null exceptions are handled.

Steps to Reproduce
Here is the meat of the lambda function:

public APIGatewayProxyResponse FunctionHandler(APIGatewayProxyRequest request, ILambdaContext context) => new APIGatewayProxyResponse()
{
    StatusCode = 200,
    Body = Environment.GetEnvironmentVariable(new Guid().ToString())
};

Publish this, add the layer, and send the initial JSON and the error occurs.

For Maintainers Only or Hero Triaging this bug
P2
S

@jaffinito jaffinito added the bug Something isn't working label Jun 6, 2024
@workato-integration
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant