{"action":"created","issue":{"url":"https://api.github.com/repos/aws/aws-xray-sdk-dotnet/issues/21","repository_url":"https://api.github.com/repos/aws/aws-xray-sdk-dotnet","labels_url":"https://api.github.com/repos/aws/aws-xray-sdk-dotnet/issues/21/labels{/name}","comments_url":"https://api.github.com/repos/aws/aws-xray-sdk-dotnet/issues/21/comments","events_url":"https://api.github.com/repos/aws/aws-xray-sdk-dotnet/issues/21/events","html_url":"https://github.com/aws/aws-xray-sdk-dotnet/issues/21","id":307569019,"number":21,"title":"The XRayPipelineHandler will throw a null reference exception if the client does not have a RegionEndpoint assigned.","user":{"login":"bittercoder","id":156155,"avatar_url":"https://avatars2.githubusercontent.com/u/156155?v=4","gravatar_id":"","url":"https://api.github.com/users/bittercoder","html_url":"https://github.com/bittercoder","followers_url":"https://api.github.com/users/bittercoder/followers","following_url":"https://api.github.com/users/bittercoder/following{/other_user}","gists_url":"https://api.github.com/users/bittercoder/gists{/gist_id}","starred_url":"https://api.github.com/users/bittercoder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bittercoder/subscriptions","organizations_url":"https://api.github.com/users/bittercoder/orgs","repos_url":"https://api.github.com/users/bittercoder/repos","events_url":"https://api.github.com/users/bittercoder/events{/privacy}","received_events_url":"https://api.github.com/users/bittercoder/received_events","type":"User","site_admin":false},"labels":[{"id":551794535,"url":"https://api.github.com/repos/aws/aws-xray-sdk-dotnet/labels/bug","name":"bug","color":"ee0701","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-03-22T09:43:22Z","updated_at":"2018-03-23T20:02:34Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"The XRayPipelineHandler will throw a null reference exception if the client does not have a RegionEndpoint assigned.\r\n\r\nhttps://github.com/aws/aws-xray-sdk-dotnet/blob/master/sdk/src/Handlers/AwsSdk/Internal/XRayPipelineHandler.cs#L300\r\n\r\n```\r\nsubsegment.Aws[\"region\"] = client.RegionEndpoint.SystemName;\r\n```\r\n\r\nIf for some reason you have an AWS service where you are explicitly setting the clients `ServiceURL` then the region endpoint will be null - in these cases this will cause the XRay SDK to blow up.\r\n\r\nA good example of this is if your developing against local dev copies of AWS services (e.g. when employing local stack for local development).\r\n\r\nIt appears the AWS sub segment does not have anywhere to put the service URL for a request - but it does at least allow the region to be omitted if unavailable, so it wuold be great to change the code to be:\r\n\r\n```\r\nif (client.RegionEndpoint != null) {\r\n    subsegment.Aws[\"region\"] = client.RegionEndpoint.SystemName;\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/aws/aws-xray-sdk-dotnet/issues/comments/375782665","html_url":"https://github.com/aws/aws-xray-sdk-dotnet/issues/21#issuecomment-375782665","issue_url":"https://api.github.com/repos/aws/aws-xray-sdk-dotnet/issues/21","id":375782665,"user":{"login":"bittercoder","id":156155,"avatar_url":"https://avatars2.githubusercontent.com/u/156155?v=4","gravatar_id":"","url":"https://api.github.com/users/bittercoder","html_url":"https://github.com/bittercoder","followers_url":"https://api.github.com/users/bittercoder/followers","following_url":"https://api.github.com/users/bittercoder/following{/other_user}","gists_url":"https://api.github.com/users/bittercoder/gists{/gist_id}","starred_url":"https://api.github.com/users/bittercoder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bittercoder/subscriptions","organizations_url":"https://api.github.com/users/bittercoder/orgs","repos_url":"https://api.github.com/users/bittercoder/repos","events_url":"https://api.github.com/users/bittercoder/events{/privacy}","received_events_url":"https://api.github.com/users/bittercoder/received_events","type":"User","site_admin":false},"created_at":"2018-03-23T20:02:34Z","updated_at":"2018-03-23T20:02:34Z","author_association":"CONTRIBUTOR","body":"@yogiraj07 so if I was to add service Url to the annotations for the segment in the AWS SDK handler - is that behaviour you would be happy to accept as a pull request?"}}
{"actor":{"display_login":"bittercoder"}}