Hi guys,
I am trying to add AWS X-Ray to our solution which includes S3, Lambda and DynamoDB services, but I am struggling with the exception "Entity doesn't exist in callcontext".
Normally, I would need the X-Ray service in a library project started via WCF webservice file (.svc), but in order to break down the problem I tried it in a simple console application having following minimum sample code and exactly the same error occurs:
private static void Main(string[] args)
{
AWSSDKHandler.RegisterXRayForAllServices();
var lambdaClient = new AmazonLambdaClient(awsCredentials, regionEndpoint);
lambdaClient.Invoke(new InvokeRequest { ... });
}
When disabling line RegisterXRayForAllServices lambda request is working, when enabling the line, following exception is thrown when invoking the lambda request:
at Amazon.XRay.Recorder.Core.Internal.Context.CallContextContainer.GetEntity()
at Amazon.XRay.Recorder.Handlers.AwsSdk.Internal.XRayPipelineHandler.ProcessBeginRequest(IExecutionContext executionContext)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Amazon.XRay.Recorder.Handlers.AwsSdk.Internal.XRayPipelineHandler.ProcessBeginRequest(IExecutionContext executionContext)
at Amazon.XRay.Recorder.Handlers.AwsSdk.Internal.XRayPipelineHandler.InvokeSync(IExecutionContext executionContext)
at Amazon.Runtime.Internal.CallbackHandler.InvokeSync(IExecutionContext executionContext) in D:\JenkinsWorkspaces\trebuchet-stage-release\AWSDotNetPublic\sdk\src\Core\Amazon.Runtime\Pipeline\Handlers\CallbackHandler.cs:line 46
at Amazon.Runtime.Internal.ErrorCallbackHandler.InvokeSync(IExecutionContext executionContext) in D:\JenkinsWorkspaces\trebuchet-stage-release\AWSDotNetPublic\sdk\src\Core\Amazon.Runtime\Pipeline\Handlers\ErrorCallbackHandler.cs:line 44
at Amazon.Runtime.Internal.MetricsHandler.InvokeSync(IExecutionContext executionContext) in D:\JenkinsWorkspaces\trebuchet-stage-release\AWSDotNetPublic\sdk\src\Core\Amazon.Runtime\Pipeline\Handlers\MetricsHandler.cs:line 40
at Amazon.Runtime.Internal.RuntimePipeline.InvokeSync(IExecutionContext executionContext) in D:\JenkinsWorkspaces\trebuchet-stage-release\AWSDotNetPublic\sdk\src\Core\Amazon.Runtime\Pipeline\RuntimePipeline.cs:line 136
at Amazon.Runtime.AmazonServiceClient.Invoke[TResponse](AmazonWebServiceRequest request, InvokeOptionsBase options) in D:\JenkinsWorkspaces\trebuchet-stage-release\AWSDotNetPublic\sdk\src\Core\Amazon.Runtime\AmazonServiceClient.cs:line 206
at Program.Main(String[] args) in Program.cs:line 42
Versions in use:
- .Net Framework 4.7.2
- Nuget AWSDDK.Lambda 3.7.13.16
- Nuget AWSXRayRecoder: 2.10.1
In other projects without AWS services I do not have problems with RegisterXRay(this, "Program") and adding own segments and custom endpoints behaviors for WCF services, but here I would need some help, how to correctly setup the XRay recorder for AWS services.
Is there anything additionally required in App.config/Web.config?
Thank you and BR
Fabian