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

GET template method sometimes returns 406 #1041

Closed
gastonmuijtjens opened this issue Sep 7, 2020 · 4 comments
Closed

GET template method sometimes returns 406 #1041

gastonmuijtjens opened this issue Sep 7, 2020 · 4 comments
Labels
type: support ticket that should be redirected to support

Comments

@gastonmuijtjens
Copy link

gastonmuijtjens commented Sep 7, 2020

Issue Summary

I have a service running in Azure which daily calls the GET templates (https://sendgrid.com/docs/API_Reference/Web_API_v3/Transactional_Templates/templates.html#-GET) endpoint for the same template id using this C# Nuget package (see code example below). Approximately 20-40% of the calls for exactly the same template id fail due to SendGrid returning a 406. Most of the times the calls work just fine though, it is very unpredictable.

This might be an issue on the SendGrid server side, rather than a specific issue for this Nuget Package.

Steps to Reproduce

I am not able to reproduce this issue locally. It happens at some moments within Azure.

  1. Call the GET templates endpoint with an existing template id

Code Snippet

The following code runs for the same template id (which I'm sure exists within the template manager in SendGrid).

private readonly ISendGridClient _client;

private async Task CheckTemplateByIdAsync(string templateId)
{
    var templateResponse = await _client.RequestAsync(BaseClient.Method.GET, urlPath: $"/templates/{templateId}");
    if (templateResponse.StatusCode != HttpStatusCode.OK)
    {
        // ...
    }
}

Dependency injection configuration:

 public static void ConfigureServices(IServiceCollection serviceCollection)
 {
       serviceCollection.AddSendGrid(opt =>
       {
           opt.ApiKey = _configuration["SendGridApiKey"];
       });
 }

Exception/Log

SendGrid gives a 406 response.

Technical details:

  • sendgrid-csharp version: 9.18.0
@JayDZimmerman
Copy link

We were seeing this yesterday: one of our four environments in Azure was getting the 406 errors. Working fine all morning, majority errored during the afternoon, and then cleared back up sometime last night/this morning. I am guessing the problem was not with the API package but rather something on the SendGrid server side. Hopefully it is an anomaly and doesn't resurface.

@childish-sambino childish-sambino added the type: support ticket that should be redirected to support label Sep 11, 2020
@thinkingserious
Copy link
Contributor

Hello @gastonmuijtjens,

Thanks for submitting a GitHub issue! We are very sorry that you are running into this problem. In order to better serve you, as this does not present itself as a library specific issue, we would like to ask that you reach out to our support team at https://support.sendgrid.com.

Thank you!

SendGrid DX Team

@hhermas
Copy link

hhermas commented Sep 29, 2020

@thinkingserious
This is not fixed. We are still encountering 406 Not Acceptable errors on GET /templates/{templateId}.
At least 5 failures with the same message across almost an hour seems like not really transient.

Response body:

<html>
<head><title>406 Not Acceptable</title></head>
<body bgcolor="white">
<center><h1>406 Not Acceptable</h1></center>
<hr><center>nginx</center>
</body>
</html>

Here is a similar issue reported for the Python version of SendGrid's library back in 2015, which was fixed by patching the library itself:
sendgrid/sendgrid-python#149

@childish-sambino
Copy link
Contributor

@hhermas I don't see any patches to fix the problem in python and users still reported issue after the mentioned release. This is something that requires assistance from support as linked above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: support ticket that should be redirected to support
Projects
None yet
Development

No branches or pull requests

5 participants