powertools-lambda-dotnet icon indicating copy to clipboard operation
powertools-lambda-dotnet copied to clipboard

Bug: Batch Processing breaks Tracing

Open CoreySchnedl opened this issue 1 year ago • 2 comments

Expected Behaviour

Tracing show show segments within x-ray when the batch processing utility is used.

I am unable to get Tracing to work (previously worked fine before converting to using the Batch Processing Powertools functionality).

Current Behaviour

Receiving this error on invocation:

{
  "errorType": "NullReferenceException",
  "errorMessage": "Object reference not set to an instance of an object.",
  "stackTrace": [
    "at System.Object.GetType()",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 693",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 836",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 828",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 836",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 767",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 767",
    "at Amazon.XRay.Recorder.Core.Internal.Emitters.JsonSegmentMarshaller.WriteEntityFields(Entity entity, JsonWriter writer) in /_/sdk/src/Core/Internal/Emitters/JsonSegmentMarshaller.cs:line 153",
    "at Amazon.XRay.Recorder.Core.Internal.Emitters.JsonSegmentMarshaller.EntityExporter(Entity entity, JsonWriter writer) in /_/sdk/src/Core/Internal/Emitters/JsonSegmentMarshaller.cs:line 65",
    "at ThirdParty.LitJson.JsonMapper.WriteValue(Object obj, JsonWriter writer, Boolean writer_is_private, Int32 depth) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 790",
    "at ThirdParty.LitJson.JsonMapper.ToJson(Object obj) in /_/sdk/src/Core/ThirdParty/LitJson/JsonMapper.cs:line 851",
    "at Amazon.XRay.Recorder.Core.Internal.Emitters.JsonSegmentMarshaller.Marshall(Entity segment) in /_/sdk/src/Core/Internal/Emitters/JsonSegmentMarshaller.cs:line 58",
    "at Amazon.XRay.Recorder.Core.Internal.Emitters.UdpSegmentEmitter.Send(Entity segment) in /_/sdk/src/Core/Internal/Emitters/UdpSegmentEmitter.cs:line 73",
    "at Amazon.XRay.Recorder.Core.Strategies.DefaultStreamingStrategy.Stream(Entity entity, ISegmentEmitter emitter) in /_/sdk/src/Core/Strategies/DefaultStreamingStrategy.cs:line 80",
    "at Amazon.XRay.Recorder.Core.Strategies.DefaultStreamingStrategy.Stream(Entity entity, ISegmentEmitter emitter) in /_/sdk/src/Core/Strategies/DefaultStreamingStrategy.cs:line 65",
    "at Amazon.XRay.Recorder.Core.Strategies.DefaultStreamingStrategy.Stream(Entity entity, ISegmentEmitter emitter) in /_/sdk/src/Core/Strategies/DefaultStreamingStrategy.cs:line 65",
    "at Amazon.XRay.Recorder.Core.AWSXRayRecorder.EndFacadeSegment() in /_/sdk/src/Core/AWSXRayRecorder.netcore.cs:line 408",
    "at Amazon.XRay.Recorder.Core.AWSXRayRecorder.ProcessEndSubsegmentInLambdaContext(Nullable`1 timestamp) in /_/sdk/src/Core/AWSXRayRecorder.netcore.cs:line 371",
    "at Amazon.XRay.Recorder.Core.AWSXRayRecorder.EndSubsegment(Nullable`1 timestamp) in /_/sdk/src/Core/AWSXRayRecorder.netcore.cs:line 328",
    "at AWS.Lambda.Powertools.Tracing.Internal.XRayRecorder.EndSubsegment()",
    "at CoolFunction.Function.FunctionHandler(SQSEvent sqsEvent, ILambdaContext _context)",
    "at lambda_method1(Closure, Stream, ILambdaContext, Stream)",
    "at Amazon.Lambda.RuntimeSupport.HandlerWrapper.<>c__DisplayClass8_0.<GetHandlerWrapper>b__0(InvocationRequest invocation) in /src/Repo/Libraries/src/Amazon.Lambda.RuntimeSupport/Bootstrap/HandlerWrapper.cs:line 54",
    "at Amazon.Lambda.RuntimeSupport.LambdaBootstrap.InvokeOnceAsync(CancellationToken cancellationToken) in /src/Repo/Libraries/src/Amazon.Lambda.RuntimeSupport/Bootstrap/LambdaBootstrap.cs:line 185"
  ]
}

Code snippet

Function.cs

public class Function
{
    private readonly IServiceProvider _serviceProvider;

    public Function(IServiceProvider serviceProvider)
    {
        _serviceProvider = serviceProvider;
    }

    public Function()
    {
        Tracing.RegisterForAllServices();
        _serviceProvider = InitServices.Provider;
    }

    [Logging(ClearState = true)]
    [Tracing]
    public async Task<BatchItemFailuresResponse> FunctionHandler(SQSEvent sqsEvent, ILambdaContext _context)
    {
        var batchProcessor = _serviceProvider.GetRequiredService<ISqsBatchProcessor>();
        var recordHandler = _serviceProvider.GetRequiredService<ISqsRecordHandler>();
        var result = await batchProcessor.ProcessAsync(sqsEvent, recordHandler);

        return result.BatchItemFailuresResponse;
    }
}


### Possible Solution

Unable to triage this issue.

### Steps to Reproduce

Write a lambda function that utilizes both batch processing and tracing via annotations. 

### Powertools for AWS Lambda (.NET) version

latest

### AWS Lambda function runtime

dotnet6

### Debugging logs

_No response_

CoreySchnedl avatar Aug 08 '24 20:08 CoreySchnedl

Thanks for opening your first issue here! We'll come back to you as soon as we can. In the meantime, check out the #dotnet channel on our Powertools for AWS Lambda Discord: Invite link

boring-cyborg[bot] avatar Aug 08 '24 20:08 boring-cyborg[bot]

I have created this MVP sample repository to demonstrate the issue. The code is pretty simple, but is throwing the exception noted above. What am I doing wrong, or is this a bug?

https://github.com/CoreySchnedl/dotnet-powertools-issue-630-sample

CoreySchnedl avatar Aug 08 '24 22:08 CoreySchnedl

Hi @CoreySchnedl! Thank you for opening this issue and providing a small project to reproduce the bug, that is really helpful! We will work on reproducing the bug this week and see if we need to create a bugfix to resolve this issue or if there is something we can change in this project that will fix the problem.

We will update this issue as soon as we have more information.

leandrodamascena avatar Aug 11 '24 22:08 leandrodamascena

Hi @CoreySchnedl as a workaround while we do a release to fix this bug, if you are not using the Metadata in X-Ray you could change the POWERTOOLS_TRACER_CAPTURE_RESPONSE environment variable to false. This will stop Tracing from trying to add the RecordHandlerResult to the Metadata field in X-Ray which is the cause for the exception you are seeing.

Another approach if you don't want to lose the Metadata from other methods that have the Tracing decorator you could manually add a Tracing subsegment.


public class CustomSqsRecordHandler : ISqsRecordHandler
{
    // [Tracing] -- remove the decorator
    public async Task<RecordHandlerResult> HandleAsync(SQSEvent.SQSMessage record, CancellationToken cancellationToken)
    {
        
        /*
         * Your business logic.
         * If an exception is thrown, the item will be marked as a partial batch item failure.
         */
        Logger.LogInformation($"Handling SQS record with message id: '{record.MessageId}'.");

        Logger.LogInformation($"Handling record with body: {record.Body}");

        var product = JsonSerializer.Deserialize<Product>(record.Body);

        Tracing.WithSubsegment("Custom Record Handler", (subsegment) =>
        {
           // if you uncomment this line you will see that it will fail
            // subsegment.AddMetadata("Data", RecordHandlerResult.FromData(product));

            SomeCoolFunction();
            SomeCoolFunction();
        });

        Logger.LogInformation($"Handling product with id: {product!.SomeCoolField}");
        
        return await Task.FromResult(RecordHandlerResult.FromData(product));
    }

    [Tracing]
    private static bool SomeCoolFunction()
    {
        return true;
    }
}

hjgraca avatar Aug 20 '24 11:08 hjgraca

Release 1.13 Batch v1.1.2 Tracing v1.5.1

hjgraca avatar Aug 29 '24 11:08 hjgraca