dotAPNS icon indicating copy to clipboard operation
dotAPNS copied to clipboard

The request was aborted when sending notification to development server only.

Open kikaragyozov opened this issue 1 year ago • 1 comments

Describe the bug I'm able to send a push notification to the production server for an Apple Pass wallet for the specified device, using the same certificate I used to generate my apple wallets. But, when I want to do the same for the development server, I get the following exception:

The HTTP/2 server sent invalid data on the connection. HTTP/2 error code 'NO_ERROR' (0x0).

Code snippet

var apns = ApnsClient.CreateUsingCert(passbookCertificate);
var push = new ApplePush(ApplePushType.Background)
    .AddToken("<pushToken>")
    .SendToDevelopmentServer();
var response = await apns.SendAsync(push);

Expected behavior No errors when sending a push notification to the development server.

Actual behavior I get the following exception:

System.Net.Http.HttpRequestException: 'The request was aborted.'
Inner Exception: Http2ConnectionException: The HTTP/2 server sent invalid data on the connection. HTTP/2 error code 'NO_ERROR' (0x0).
Stack Trace:
   at System.Net.Http.Http2Connection.ThrowRetry(String message, Exception innerException)
   at System.Net.Http.Http2Connection.Http2Stream.CheckResponseBodyState()
   at System.Net.Http.Http2Connection.Http2Stream.TryEnsureHeaders()
   at System.Net.Http.Http2Connection.Http2Stream.<ReadResponseHeadersAsync>d__66.MoveNext()
   at System.Net.Http.Http2Connection.<SendAsync>d__105.MoveNext()
   at System.Net.Http.HttpConnectionPool.<SendWithVersionDetectionAndRetryAsync>d__83.MoveNext()
   at System.Net.Http.DiagnosticsHandler.<SendAsyncCore>d__8.MoveNext()
   at System.Threading.Tasks.ValueTask`1.get_Result()
   at System.Runtime.CompilerServices.ConfiguredValueTaskAwaitable`1.ConfiguredValueTaskAwaiter.GetResult()
   at System.Net.Http.RedirectHandler.<SendAsync>d__4.MoveNext()
   at System.Net.Http.HttpClient.<<SendAsync>g__Core|83_0>d.MoveNext()
   at dotAPNS.ApnsClient.<SendAsync>d__17.MoveNext()
   at Program.<<Main>$>d__0.MoveNext() in C:\MyStorage\My Stuff\AppleWallet\AppleWallet\AppleWallet\Program.cs:line 26

Environment .NET version: 6.0 dotAPNS version: 4..2.1

kikaragyozov avatar Oct 08 '22 05:10 kikaragyozov

I get a feeling it has to do with the fact the certificate was probably created only for a production environment.

kikaragyozov avatar Oct 08 '22 05:10 kikaragyozov

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Nov 07 '22 06:11 stale[bot]