Cannot create new subscription to resource
APP BACKGROUND
I have an app that integrate with Microsoft Graph API in order to create subscriptions for some resources.
In order to keep subscriptions valid for a long period, I have to update it to continue receiving change notifications on these resources.
Basically my workflow for refresh a subscription is:
First I try to patch the subscription through this endpoint: PATCH https://graph.microsoft.com/v1.0/subscriptions/{subscription_id}If something fails and I couldn’t update it I have a fallback process that deletes it and recreate the subscription after.To delete the subscription I call this endpoint: DELETE https://graph.microsoft.com/v1.0/subscriptions/{subscription_id}And right after I call the endpoint to create the subscription again: POST https://graph.microsoft.com/v1.0/subscriptions/
ISSUE
This process works well the most part of the time, but during some hours ( generally during 1~3h) on random days, it stop to work for some random resources.
Basically I receive a 404 status from Microsoft when trying to patch or delete the subscription (which is expected on this case), but when I attempt to create a new subscription it returns a 403 error saying:
Operation: Create; Exception: [Status Code: Forbidden; Reason: App ‘aaaa-bbbb-cccc-dddd-ffff’ has reached its limit of ‘1’ ‘USERS/AAAAA-BBBB-CCCC-DDDD-EEEE/CHATS/GETALLMESSAGES’ subscription on tenant ‘aaaaa-hhhhhh-jjjj-uuuu-zzzz
How could the subscription already exists if previously it returned a 404 saying that it doesn’t exists?
SAMPLE REQUEST ID
Following the request id a sample of this issue:
PATCH https://graph.microsoft.com/v1.0/subscriptions/{subscription_id}
date: 2024-07-15T17:08:03request-id: f5504a6c-b571-4ee4-893c-b96aae64a759client-request-id: f5504a6c-b571-4ee4-893c-b96aae64a759result: 404 – Not foundDELETE https://graph.microsoft.com/v1.0/subscriptions/{subscription_id}
date: 2024-07-15T17:08:03request-id: 1d3c601d-f761-43f2-8260-c30bf7a3540eclient-request-id: 1d3c601d-f761-43f2-8260-c30bf7a3540eresult: 404 – Not foundPOST https://graph.microsoft.com/v1.0/subscriptions/date: 2024-07-15T17:08:03request-id: c06196f7-d3c2-4a7d-8e7b-6fc9d63ec496client-request-id: c06196f7-d3c2-4a7d-8e7b-6fc9d63ec496result: 403 – Forbidden – App ‘aaa-bbb-cc’ has reached its limit of ‘1’ ‘USERS/DDD-FFF-GGG/CHATS/GETALLMESSAGES’ subscription on tenant ‘bbb-dddd-aaa-eeeee’
APP BACKGROUNDI have an app that integrate with Microsoft Graph API in order to create subscriptions for some resources.In order to keep subscriptions valid for a long period, I have to update it to continue receiving change notifications on these resources.Basically my workflow for refresh a subscription is:First I try to patch the subscription through this endpoint: PATCH https://graph.microsoft.com/v1.0/subscriptions/{subscription_id}If something fails and I couldn’t update it I have a fallback process that deletes it and recreate the subscription after.To delete the subscription I call this endpoint: DELETE https://graph.microsoft.com/v1.0/subscriptions/{subscription_id}And right after I call the endpoint to create the subscription again: POST https://graph.microsoft.com/v1.0/subscriptions/ ISSUEThis process works well the most part of the time, but during some hours ( generally during 1~3h) on random days, it stop to work for some random resources.Basically I receive a 404 status from Microsoft when trying to patch or delete the subscription (which is expected on this case), but when I attempt to create a new subscription it returns a 403 error saying: Operation: Create; Exception: [Status Code: Forbidden; Reason: App ‘aaaa-bbbb-cccc-dddd-ffff’ has reached its limit of ‘1’ ‘USERS/AAAAA-BBBB-CCCC-DDDD-EEEE/CHATS/GETALLMESSAGES’ subscription on tenant ‘aaaaa-hhhhhh-jjjj-uuuu-zzzz How could the subscription already exists if previously it returned a 404 saying that it doesn’t exists?SAMPLE REQUEST IDFollowing the request id a sample of this issue:PATCH https://graph.microsoft.com/v1.0/subscriptions/{subscription_id}date: 2024-07-15T17:08:03request-id: f5504a6c-b571-4ee4-893c-b96aae64a759client-request-id: f5504a6c-b571-4ee4-893c-b96aae64a759result: 404 – Not foundDELETE https://graph.microsoft.com/v1.0/subscriptions/{subscription_id}date: 2024-07-15T17:08:03request-id: 1d3c601d-f761-43f2-8260-c30bf7a3540eclient-request-id: 1d3c601d-f761-43f2-8260-c30bf7a3540eresult: 404 – Not foundPOST https://graph.microsoft.com/v1.0/subscriptions/date: 2024-07-15T17:08:03request-id: c06196f7-d3c2-4a7d-8e7b-6fc9d63ec496client-request-id: c06196f7-d3c2-4a7d-8e7b-6fc9d63ec496result: 403 – Forbidden – App ‘aaa-bbb-cc’ has reached its limit of ‘1’ ‘USERS/DDD-FFF-GGG/CHATS/GETALLMESSAGES’ subscription on tenant ‘bbb-dddd-aaa-eeeee’ Read More