question

AmiramKorach-3380 avatar image
0 Votes"
AmiramKorach-3380 asked saldana-msft edited

Microsoft Graph API Retry-After is not exposed in browser

We're using Graph API from office-js addin to send messages. Sometimes the user is sending many attachments and our app is getting throttled. In the response there is a Retry-After header, sometimes for a long time like 3 minutes. The problem is that since our code run in a browser, we can't access the Retry-After header since it is not exposed. The header that should expose it only expose these headers:
ETag, Location, Preference-Applied, Content-Range, request-id, client-request-id, ReadWriteConsistencyToken, SdkVersion, WWW-Authenticate

Retry-After is missing.

microsoft-graph-sdkoffice-js-dev
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.

Deva-MSFT avatar image
0 Votes"
Deva-MSFT answered
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.

AmiramKorach-3380 avatar image
0 Votes"
AmiramKorach-3380 answered

Thanks @Deva-MSFT . I'm not using Graph SDK but just making http requests. I already implemented my own retry handler that relies on the Retry-After header with a fallback to exponential backoff. We are limiting the user with the upload speed already. We get many 429 errors for mailbox concurrency limit, but according to docs we should be able to make 4 in parallel, and practically even 2 calls get blocked. Using an SDK won't help because the browser hides the Retry-After header since it is not in the Access-Control-Expose-Headers as I wrote, so the SDK won't no about that either. Exponential backoff won't help since it is a very long time sometimes. We just need this header to be exposed.

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.