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

NullReferenceException in MetricsHandler when ResponseMetadata is null #3493

Open
1 task
hwoodiwiss opened this issue Sep 30, 2024 · 3 comments
Open
1 task
Labels
bug This issue is a bug. module/sdk-core needs-review p2 This is a standard priority issue

Comments

@hwoodiwiss
Copy link

Describe the bug

I'll preface this with the fact that I don't expect that this is likely/can happen in usual operation of the SDK against an actual AWS service.

While testing using an HTTP client interception library, in recent versions of AWSSDK.SimpleNotificationService, if the ResponseMetadata is not set in the response, a NullReferenceException is thrown in MetricsHandler.

Regression Issue

  • Select this option if this issue appears to be a regression.

Expected Behavior

I would expect the metrics handler to handle the null case for ResponseMetadata more defensively, and then either throw a descriptive exception, or silently continue.

Current Behavior

Throws NullReferenceException dereferencing null ResponseMetadata when trying to set RequestId span attribute

Reproduction Steps

I'll have to get back to you with this later.

Possible Solution

No response

Additional Information/Context

No response

AWS .NET SDK and/or Package version used

AWSSDK.SimpleNotificationService 3.7.400.26 (though likely applies to several more as this will be based on the resolved AWSSDK.Core library version)

Targeted .NET Platform

.NET 8

Operating System and version

Windows 10, Ubuntu (CI Runner)

@hwoodiwiss hwoodiwiss added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Sep 30, 2024
@muhammad-othman
Copy link
Contributor

Hi @hwoodiwiss
Thank you for raising this issue! The ResponseMetadata is a part of the response that’s automatically initialized and included in AWS SDK operations. It’s designed for internal use, and we didn’t anticipate that other libraries would handle it differently or modify its behavior.

We’ll definitely look into this further, but I’m curious what interception library are you using?

@hwoodiwiss
Copy link
Author

Hey @muhammad-othman, thanks for responding so quickly, I'm using an internal library built on top of https://github.com/justeattakeaway/httpclient-interception.

Yeah that makes sense, I appreciate it's not a common use-case, I just thought it worth raising, in case we can blunt a slightly sharp edge.

@bhoradc bhoradc added module/sdk-core p2 This is a standard priority issue and removed needs-triage This issue or PR still needs to be triaged. labels Sep 30, 2024
@ashishdhingra
Copy link
Contributor

Needs review with the team.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. module/sdk-core needs-review p2 This is a standard priority issue
Projects
None yet
Development

No branches or pull requests

4 participants