Create presence subscription creates multiple subscriptions

R_R@spring 25 Reputation points
2023-12-28T12:25:15.7366667+00:00

We have a use-case to create a presence subscription when Teams user navigates to our custom app. The logic each time the user visits the app is to delete the previous subscription and to create a new one. Everything works fine when run locally.

Once we deployed our app server to AWS elastic container, which consists of a load-balancer and 2 instances of the server running, the createSubscription API seems tries to create two subscriptions. As a result we face an error

Error in createSubscription --Error: Operation: Create; Exception: [Status Code: Conflict; Reason: The subscription conflict - Subscription already exists.

I would like to understand more about the createSubscription behavior with multiple server instances to troubleshoot the issue.

Sharing some logs below when the previous subscription is deleted and a new one is being created

December 26, 2023 at 22:01 (UTC-8:00) {ts: 2023-12-27 06:01:27:127, level: [32minfo[39m, module: PresenceManager, id:71903491-7ea4-4f9b-8529-11b6fd81ac5d, msg: [32mDeleting subscription [39m}

December 26, 2023 at 22:04 (UTC-8:00) 192.168.0.60 - - [27/Dec/2023:06:04:12 +0000] "POST /presence-notify?validationToken=Validation%3a+Testing+client+application+reachability+for+subscription+Request-Id%3a+074ce532-1f77-2726-1ab2-d405d3e63547 HTTP/1.1" 200 117 "-" "-" "52.159.107.4"

December 26, 2023 at 22:04 (UTC-8:00) {ts: 2023-12-27 06:04:12:412, level: [35mhttp[39m, module: RestifyServer, msg: [35m127.0.0.1 - POST /presence-notify?validationToken=Validation%3a+Testing+client+application+reachability+for+subscription+Request-Id%3a+074ce532-1f77-2726-1ab2-d405d3e63547 HTTP/1.0 200 117 - 0.245 ms[39m

December 26, 2023 at 22:04 (UTC-8:00) 192.168.1.96 - - [27/Dec/2023:06:04:12 +0000] "POST /presence-notify?validationToken=Validation%3a+Testing+client+application+reachability+for+subscription+Request-Id%3a+a9b4dcda-4ed2-1614-7e7c-2c349b7aa4ac HTTP/1.1" 200 117 "-" "-" "20.25.189.138"

December 26, 2023 at 22:04 (UTC-8:00) {ts: 2023-12-27 06:04:12:412, level: [35mhttp[39m, module: RestifyServer, msg: [35m127.0.0.1 - POST /presence-notify?validationToken=Validation%3a+Testing+client+application+reachability+for+subscription+Request-Id%3a+a9b4dcda-4ed2-1614-7e7c-2c349b7aa4ac HTTP/1.0 200 117 - 0.427 ms[39m

December 26, 2023 at 22:04 (UTC-8:00) {ts: 2023-12-27 06:04:13:413, level: [34mdebug[39m, module: PresenceManager, msg: [34mCreated presence subscription: 21e2b4a5-218c-4567-a441-28d7cf88902d for user d3a2a55a-de7f-472d-97f6-12bd4e81febf[39m}

December 26, 2023 at 22:04 (UTC-8:00) {ts: 2023-12-27 06:04:13:413, level: [32minfo[39m, module: PresenceManager, msg: [32mInitiate re-subscription to presence changes for connection cdd2d8dd-cbfc-49aa-8dba-bf9ee5e1e771[39m}

December 26, 2023 at 22:04 (UTC-8:00) {ts: 2023-12-27 06:04:13:413, level: [33mwarn[39m, module: PresenceManager, msg: [33mError in createSubscription --Error: Operation: Create; Exception: [Status Code: Conflict; Reason: The subscription conflict - Subscription already exists.][39m}

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
13,329 questions
Microsoft Teams Development
Microsoft Teams Development
Microsoft Teams: A Microsoft customizable chat-based workspace.Development: The process of researching, productizing, and refining new or existing technologies.
3,705 questions
{count} votes

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.