question

AndyLi-3525 avatar image
0 Votes"
AndyLi-3525 asked YuZhou-MSFT commented

Increase in intermittent WNS 401 Unauthorized responses from webpush-java pushService.send() call

Hello!

I use webpush-java library to send requests to browser pushServices to produce push notifications for a web application. I recently saw spikes in errors on my end from WNS from my call to webpush-java's pushService.send(), particularly spiking from 3/31/22 to 4/1/22. I saw an increase in intermittent 401 Unauthorized responses being returned with an error invalid_request and error description Invalid token. The responses all had WNS related headers in the responses. I haven't changed any of my applicationServerKeys or the way we call the push service. I've also checked webpush-java pushService library for any recent changes, and there's not significant changes there either. A few examples of responses I'm seeing on my end are...

  • HTTP/1.1 401 Unauthorized [Content-Length: 0, X-WNS-MSG-ID: 10E192C05091AB36, X-WNS-DEBUG-TRACE: SG2PEPF000010B5, MS-CV: 8LXBo+0yu0etGpbGBPQ/Iw.0, Strict-Transport-Security: max-age=31536000; includeSubDomains, WWW-Authenticate: bearer error="invalid_request",error_description="Invalid token", Date: Fri, 01 Apr 2022 19:57:39 GMT] [Content-Length: 0,Chunked: false]

  • HTTP/1.1 401 Unauthorized [Content-Length: 0, X-WNS-MSG-ID: 60DE203C7FF92909, X-WNS-DEBUG-TRACE: BY3PEPF0000E9BD, MS-CV: vzDpwIihMk2WDtEgFCY9qw.0, Strict-Transport-Security: max-age=31536000; includeSubDomains, WWW-Authenticate: bearer error="invalid_request",error_description="Invalid token", Date: Fri, 01 Apr 2022 14:02:01 GMT] [Content-Length: 0,Chunked: false]

This seems to intermittently happen. Why would my tokens mismatch or be invalid if I haven't recently changed any of my keys. In addition, when I test locally to push a browser notification, I'm able to get receive a 201 response when testing on edge, firefox, and chrome. I'd imagine if we had invalid tokens, then none of our requests would work. I also saw on WNS troubleshooting page, that 401 unauthorized can also correspond to expired token errors. Could these perhaps actually be expired token errors and not us incorrectly passing over our applicationServerKey information? The similarity between these two response messages makes it hard for me to understand which could be the issue if either at all.

Do you have any further insights on what could be going on here? Did anything recently change with the way WNS handles incoming pushService.send() requests? Thank you.

Best,

Andy





ms-edge
· 5
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @AndyLi-3525

Does the issue happen in all browsers like Edge, Firefox and Chrome or just happen in a specific browser?

0 Votes 0 ·

Hi YuZhou.

This seems to be coming specifically from Edge since I'm seeing the X-WNS... in many of my responses that are 401s. Then, for the same corresponding notification push request for I'm seeing 201 responses from Chrome. So, yes, I believe this is specific to edge and doesn't seem to happen to Chrome or Firefox at the same rate.

However, I haven't been able to reproduce the error manually in Edge locally. I've also tried reproducing manually on Chrome and Firefox, and I don't get the issue. I haven't seen many other spikes since 3/31-4/1.

Do you know if anything changed around those days? Or, is there any additional information we have on the specific 401 responses that I posted above with the WNS-DEBUG-TRACE? Thank you.

Best,

Andy

0 Votes 0 ·

Hi @AndyLi-3525

From your comment, it seems that the issue only appears on 3/31-4/1. It's hard to debug without reproducing the issue.

I don't know there's anything changed those days except there's an Edge update on April 1, 2022. I suggest that you can open an assisted support ticket to get more help if you want to investigate deeper. Thanks for your understanding.

1 Vote 1 ·

Could you clarify what you mean by assisted support ticket? I was under the impression this was a support ticket, but do I need to add a different tag or file under a different format? Do you mean the "Virtual Support agent" section?

0 Votes 0 ·
Show more comments

0 Answers