elsa-core
elsa-core copied to clipboard
Custom HTTP Endpoints in Elsa Do Not Respect TenantId in Trigger Indexing
I'm opening this issue as a follow-up to a previously closed PR/discussion (#6161 ) regarding custom HttpEndpointBase activities in Elsa with multi-tenancy.
Upon investigation, I discovered that:
The TenantId is not being set in the corresponding trigger record in the database when the workflow is published.
As a result, when Elsa attempts to match the HTTP request to a trigger, the tenant context mismatch leads to no match being found — and hence the 404.
Repro Steps:
- Create a custom HTTP activity that extends HttpEndpointBase.
- Create and publish a workflow that uses CustomHttpEndpoint as the trigger under a specific tenant.
- Send a GET request to /api/workflows/my-path while using the same tenant context.
- ❌ Observe a 404 response.
- 🛠️ Manually update the TenantId of the trigger record in the database to match the tenant used when publishing the workflow.
- 🔁 Repeat the same request — now it works as expected.
Looking into the Elsa source code, the issue seems to stem from the TriggerIndexer class — particularly the CreateWorkflowTriggersAsync method. It appears the TenantId is not being correctly assigned to the WorkflowTrigger entity when the trigger is created and stored.
I'm having the same issue when trying to create endpoints for my tenants. The TenantId is not being set in the database which means no match is found.
Tested it with 3.5.0 (current tip of the develop/3.5.0 branch) and everything works with no issue. Please feel free to reopen in case you can still reproduce the issue with 3.5.0-rc3.
Thank you!