elsa-workflows / elsa-workflows/elsa-core

[BUG] HTTP Endpoint with dynamic value in path always yields 200 with no content

Open
#5,686 1 comment 0 reactions 0 assignees View on GitHub
bug triaged
Dominant language
C#
Stars
7.9k
Forks
1.5k
Avg merge
15h 22m
Merged PRs (30d)
114

Description

## Description
### What I am generally trying to do
I am trying to make an activity which blocks and shows a popup window in an external GUI. In that window, a custom message should be shown. To accomplish this, I split the flow into three branches; two branches which wait for a Yes/No event and a branch with a HTTP Request + Response, which returns the custom message for that workflow. However, as multiple workflows may run at the same time, the HTTP endpoint needs to be unique for the current workflow instance.

### The issue
While entering a static path works fine for the setup, having `getWorkflowInstanceId()` in the path breaks multiple things.
* In the ELSA GUI, the path is correctly expanded:
![Screenshot_2-7-2024_164224_localhost](https://github.com/elsa-workflows/elsa-core/assets/6787349/b4de271a-e4c7-4c51-bcc2-b2790aee1427)
* Accessing this path via the browser returns `200 OK` with no response body, even if one is set or another response code (i.e. `500`) should be returned.
![Screenshot_20240702_164307](https://github.com/elsa-workflows/elsa-core/assets/6787349/b1c089ef-6bd5-42e6-a64f-f443bc527d8b)
* **For cross check; accessing any other url yields the expected `404 Not Found`.**
![Screenshot_20240702_164332](https://github.com/elsa-workflows/elsa-core/assets/6787349/545a1867-0143-48db-bcb3-8b49ada072c5)

## Steps to Reproduce
1. Create a workflow with a `HTTP Endpoint` and a `HTTP Response`.
2. Set the path of the HTTP endpoint to `${getWorkflowInstanceId()}/test`.
3. Set a body for the HTTP response.
4. Set the status code to something like `InternalServerError`.
5. Run the workflow and access the HTTP endpoint.

### Example workflow json
[http-bug.json](https://github.com/user-attachments/files/16070619/http-bug.json)

This occurs 100% of the time.

## Expected Behavior
Response with status code `500` and the entered body.

## Actual Behavior
Response with status code `200` and no body.

## Screenshots

## Environment
- **Elsa Package Version**: Elsa 3.2
- **Operating System**: Fedora + Podman
- **Browser and Version**: Edge Version 127.0.2651.15 (Official build) beta (64-bit)

## Log Output
Include any relevant log output or error messages that might help diagnose the issue.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.