question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Web PubSub SDK fails to refresh AAD access token with peak load

See original GitHub issue
  • Package Name: @azure/web-pubsub
  • Package Version: 1.0.0
  • Operating system: arm64-Darwin-21.6.0
  • nodejs
    • version: v16.15.0
  • typescript
    • version:
  • Is the bug related to documentation in

Describe the bug Our customer uses Web PubSub JavaScript SDK in their Azure Functions App with DefaultAzureCredential for auth. They have found that the SDK sometimes keeps failing to auth to the Web PubSub service during peak load.

To Reproduce Set up an HTTP trigger in Function App which calls any API of Web PubSub service client with DefaultAzureCredential . Then call that HTTP trigger every 0.5s for more than one day. Then you will find the REST API calls of Web PubSub service client starts to fail and keeps failing.

In our repro project https://github.com/Y-Sindo/-AzureJSSdkAuthProblemRepro , We have customized the Web PubSub service SDK so that it can log the authentication header used to auth REST API call to prove that the access token is cached for more than one day and not refreshed, thus expires.

You can find detailed steps about how to use the repro project in its README.

Expected behavior The REST API call shouldn’t fail for access token invalid lifetime issue after running for one day.

Additional context Our customer encountered the issue in their product environment and want to get a solution as soon as possible.

Suspicion The invalid lifetime token problem can mitigate itself after some time in the production environment. But in our repro project, it didn’t mitigate by itself for more than one hour until I manually stopped the calls to the Http trigger of Functions. Thus, we suspect that the refresh of AAD access token is blocked when the function APP is busy with handling incoming requests. (Actually per 0.5s a request can trigger the problem, not a high concurrency)

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:11 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
xirzeccommented, Sep 15, 2022

@Y-Sindo thank you for all your diving into this and my apologies that it seems to be a duplicate of an existing issue. I put up a PR that I think fixes it at #23232 but I need to set up a test environment to validate still.

0reactions
xirzeccommented, Sep 20, 2022

@Y-Sindo this should be fixed in @azure/identity@3.0.0 which released yesterday, please let me know if you are still seeing issues.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Managed Identity - DefaultAzureCredential - GitHub
Use Azure Identity to Authenticate with Microsoft Graph API ... Web PubSub SDK fails to refresh AAD access token with peak load #23202....
Read more >
Azure AD refresh token is getting invalid frequently
This error is due to when refresh token can be expired due to either if the password changed for the user or the...
Read more >
Push subscriptions | Cloud Pub/Sub Documentation
The service account associated with the push subscription. This account is used as the email claim of the generated JSON Web Token (JWT)....
Read more >
GET JWT Bearer token for Azure Web PubSub Rest API to ...
But I am stuck and unable to get the access token for Azure Web PubSub API. I need token to just Publish a...
Read more >
Solved: OAuth Refresh token has expired after 90 days
Solved: We have encountered an issue on our live environment: The Multi Factor Authentication does not work anymore. We try to authenticate using...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found