429 response when using OneDrive JS file picker

Alex 1 Reputation point
2022-06-14T09:09:35.98+00:00

Hello,

I use OneDrive File Picker JS v7.2.

The first 10 files can be selected as expected. But when I open the picker after that, I can choose more files, click the "Open" button, and then nothing happens.
After debugging I found the following request:
Request URL: https://graph.microsoft.com/v1.0/drives/d2b2ea24de1d44b7/items/D2B2EA24DE1D44B7!1726/microsoft.graph.createLink
Status Code: 429
{"error":{"code":"accessDenied","message":"Too Many Requests","innerError":{"code":"throttledRequest","date":"2022-06-14T08:49:37","request-id":"952b3283-cc44-4cae-95e1-96a5f16e0401","client-request-id":"952b3283-cc44-4cae-95e1-96a5f16e0401"}}}

How is it possible that using JS File Picker only (no server-side API requests) causes the "Too Many Requests" error? And how to solve this issue?

Thank you!

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
12,983 questions
0 comments No comments
{count} votes

4 answers

Sort by: Most helpful
  1. Bhanu Kiran 3,611 Reputation points
    2022-06-14T11:31:26.227+00:00

    Hi @Alex ,

    This is by design and throttling expected behavior while using OneDrive, OneDrive for business, and SharePoint Online irrespective of APIs.

    When a user exceeds usage limits, SharePoint Online/ OneDrive throttles any further requests from that user account for a short period. All user actions are throttled while the throttle is in effect.
    For requests that a user performs directly in the browser, OneDrive/SharePoint redirects you to throttling information page, and the requests fail. For all other requests, including CSOM or REST calls, OneDrive/SharePoint returns HTTP status code 429("Too Many Requests") or 503("Server Too Busy") and the request will fail.

    There is no specific limits for OneDrive/SharePoint, Service limits for OneDrive, OneDrive for Business, and SharePoint Online are not available.

    Please refer to this article for additional information:throttling

    Hope this helps,

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have further questions about this answer, please click "Comment".

    0 comments No comments

  2. Alex 1 Reputation point
    2022-06-15T12:52:40.303+00:00

    Hi @Bhanu Kiran ,

    Thank you for the answer. It is very strange that adding 10 files exhausts the limits.

    Can you please answer the following questions:

    1. Is it possible to increase the limits (for OneDrive, or for OneDrive for Business)? All other cloud storages that we use (Dropbox, Google Drive), allow adding more than 10 files in a session.

    2) Is it possible to show a meaningful message to a customer when to retry their action?

    I see that the AJAX response has a Retry-After header. But I do not see a way to get it when using the JS File Picker. It only contains the "web request failed, see console logs for details" text. But I cannot show this to customers.

    3) One more question.
    When I open a Picker window, I sign in. When I open the window again, I get the following text:

    This OneDrive view is not supported within the current session. Please reload this page in your browser in order to continue.

    Refreshing the window or page does not help. I need to delete all cookies, and then sign in again. Why is this happening, and how to avoid this?

    Generally speaking, I am using Picker for many years, and I never saw these two issues. Something was changed recently, and it caused a new problems that did not exist before.

    0 comments No comments

  3. Zehui Yao_MSFT 5,871 Reputation points
    2022-06-17T07:30:58.607+00:00

    Hi @Alex , Please try to use batch request API, I tested the operation of createLinks 11 times using postman locally and it works fine, no 429 response.
    Documentation: https://learn.microsoft.com/en-us/graph/throttling
    212452-image.png
    212443-image.png


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


  4. Alex 1 Reputation point
    2022-06-22T08:38:11.163+00:00

    I investigated this issue further.

    I suppose that one of the reasons is that I use action: 'share' and advanced.createLinkParameters: { type: 'view', scope: 'anonymous' }

    It seems that these settings cause more API requests, that are implemented in the JS File Picker not efficiently.

    Maybe, if the action is View, then JS File Picker would not hit the limits. I use the Share action instead of the default View, because I need permanent links that do not expire.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.