Hi Atlassian,
I am looking at the Forge dynamic module API docs and I see that it does not disclose any expected rate limits.
Can you share what the expected rate limits are for this service and potentially update the doc page? I am accessing it from a Forge Remote, if it matters.
The limits seem to be extremely low based on my testing, and I can easily hit the rate limits with a small number of operations. Unexpectedly, it appears that the limits are per-app and not per-site (despite the app being in the tier 2 pool).
Thanks,
Scott
Hi @scott.dudley thanks for raising this and sharing your testing experience.
We’re currently reviewing the Dynamic Modules API rate limits based on developer feedback and usage patterns following GA. We hope to finalise the limits soon and update the documentation to clarify both the thresholds and how they’re scoped. I will set a reminder and get back to you in two weeks in this thread regarding this.
In the meantime, please handle 429 Too Many Requests responses by backing off before retrying. Your feedback about hitting limits with relatively few operations is helpful input to this review.
Hi @SreejaGupta,
Thanks for the updates.
Since Atlassian is looking for feedback on dynamic modules, I will provide my two cents:
-
The rate limit absolutely needs to be per-tenant, not per app. Atlassian already has a tier1/tier2 system for global vs tenant-based rate pools, and this should definitely follow the same pattern. Activities in one tenant should not influence the ability of other tenants to complete tasks.
-
In addition to standard rate limits, I am seeing a high frequency of HTTP 5xx errors when invoking Forge dynamic modules functions. On Connect, this always worked flawlessly, and I could manipulate many dynamic modules across many tenants at the same time, and I do not ever recall seeing a single 5xx error in years in production. On Forge, the 5xx errors occur frequently.
-
In addition, a 5xx response code from the modules API does not necessarily imply failure. I have seen cases where a POST returned 5xx but the module was still created (but we don’t know which key, because we never got a response). Or sometimes it returns 5xx and the module is not created. We obviously need to retry 5xx errors, but doing this with the above uncertainty means that two modules are sometimes created.
-
In order to end up with a consistent set of modules, this means that every API client needs to perform a save-retry-reconcile-redo loop that has to retry errors when they occur, but because of the inconsistency of the 5xx responses, it then needs to read the final list of modules created to make sure that modules are not doubled or omitted, and if not the right count of modules, restart everything from the beginning. This further increases the number of required API calls.
-
the above problem is made even harder to solve due to the fact that Forge dynamic modules have generated random GUID keys, so there is no straightforward way to identify exactly which modules were successfully registered, or at least not without trying to parse the full module content and looking for distinguishing characteristics. Assume I want to register modules “a”, “b” and “c”. With 5xx errors, it’s possible that “b” was registered twice (or never), meaning I have to parse the full details of the “get module list” result afterwards. If I list only 2 modules after trying to register 3, I have to compare the contrasting attributes of the two returned modules just to figure out exactly what was registered, which is a difficult algorithm to generalize unless we know the precise details of the previously-registered modules.
-
regarding the above problem, I believe someone on the Forge team mentioned that the modules API switched to returning GUID keys because Bad Things Happen if the user tries to register a key that already exists in the static manifest. What about some sort of compromise where the user can specify a key prefix in the POST call, to which you add a GUID? For example, if I ask for keyPrefix: 'myByline', the generated dynamic module would have a key of myByline-{generatedGuid}? This would guarantee uniqueness but still allow apps to easily distinguish what was registered. This could be further enhanced if the GET “list all modules” endpoint allowed us to specify an optional prefix to search, so that we can fetch a single module or set of modules by key prefix.
-
Dealing with the existing 429 rate limits is already a problem, especially as it is cross-tenant and we are dealing with a large number of module requests. Forge functions have a relatively short runtime limit, and once we hit rate limits, it looks like we are blocked for a full minute across all tenants. If we have (say) a dozen dynamic modules to register on each tenant out of multiple, and if we hit rate limits on every other module installation, this will not fit into a single Forge function runtime, forcing us to implement a complicated system with InvocationErrors and retries. If we combine this with random 5xx errors and the reconciliation loop from above, which includes its own retries, this becomes a nightmare to manage.
To summarize, you could make vendors’ lives much easier by:
- making the rate limits per-tenant (or at least following the per-app rate limit pools where higher-usage apps get per-tenant),
- drastically reduce the frequency of 5xx errors, and also provide a better way to distinguish between 5xx errors so vendors know whether the module was created or not,
- allow vendors to specify module key prefixes, and
- allow vendors to fetch dynamic modules via key prefix.
Also, is there a timeline for supporting dynamic modules on AGC? (And is it supported on Isolated Cloud?)
super valuable feedback thank you! I will take this to the team.
AGC - not available yet, some architectural blockers are currently being worked on to allow this to happen soon. I don’t have a timeline yet unfortunately but I’ll update you here if I hear anything.
Isolated cloud - yes, dynamic modules are available 
Hi @SreejaGupta
For what it’s worth, the dynamic modules errors I am seeing are often HTTP 504s. Empirically, these requests seem to succeed (the module is still created), but the app doesn’t get the module UUID or a true confirmation of success because of this error.
The returned headers usually include something like this:
HTTP 504
X-Trace-Id: 69a917e8ba6d4322b922dcc5aaa9eaa9
X-Cache: Error from cloudfront
X-Failure-Category: FAILURE_ORIGIN_READ_TIMEOUT
Server: AtlassianEdge
Server-Timing: atl-edge;dur=5186,atl-edge-internal;dur=3,atl-edge-upstream;dur=5183,atl-edge-pop;desc="aws-us-east-1"
A successful create often takes 2-3 seconds. The above suggests that perhaps the create is still working on your back end, but it took longer than the 5000 ms that the gateway was apparently willing to wait.