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

APNs invalid certificate yields (confusing) connection error #93

Open
alixMougenot opened this issue Sep 18, 2017 · 2 comments
Open

APNs invalid certificate yields (confusing) connection error #93

alixMougenot opened this issue Sep 18, 2017 · 2 comments

Comments

@alixMougenot
Copy link

When you try to send data with an invalid certificate, you get this error:

Post https://api.push.apple.com/3/device/_token_goes_here_: http2: Transport: peer server initiated graceful shutdown after some of Request.Body was written; define Request.GetBody to avoid this error

This makes it look like a connection or implementation issue, while it is not.

When looking at the http2 logs, you can see that the gateway is explicitly telling you why they are cutting connection, the certificate is wrong: APNsConnectionCut.txt. The interesting part is: http2: Transport received GOAWAY len=46 LastStreamID=0 ErrCode=NO_ERROR Debug="{"reason":"BadCertificateEnvironment"}"
While it would have been nice from the Gateway to use the usual status error code to tell that the certificate is wrong, it does not. If there is an easy way to read GOAWAY frames to return an error that includes the eventual Debug field from Transport, it would be great to use it. If not, you may archive this report.

  1. Version: go1.7.4
  2. Env: running on darwin/amd64, same issue with a static binary on linux
  3. How-To-Reproduce: posting one silent push notification with an invalid certificate (observed on prod gateway)
  4. Observed: client.Push returns a connection/implementation error.
  5. Expected: client.Push returns a error that includes the Debug field of the associated Transport when available.
@sideshow
Copy link
Owner

sideshow commented Sep 22, 2017

@alixMougenot Thanks for logging this. Is there any chance you can give me more info about your certificate and what is invalid about it? ie, has it expired or are you trying to send using a production cert in development mode etc. Just want to make we can replicate. Thanks

@alixMougenot
Copy link
Author

alixMougenot commented Sep 22, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants