Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Http Response activity doesnt send the response before completing. #5267

Open
ciaranodonnell opened this issue Apr 24, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@ciaranodonnell
Copy link
Contributor

Description

The WriteHttpResponse activity doesn't flush the response in the HttpContext and therefore it seems common that the response isn't really sent until the workflow ends.

Steps to Reproduce

Create a workflow with an Http Endpoint trigger.
Add an Http Response activity next that just has an Accepted status.
Then add more activities after that to do work, or even just Delay the workflow.
When the workflow runs the response is not written back to the Http caller before the Http Response activity completed.

  1. Detailed Steps: Provide a step-by-step description of what leads to the bug. Be as specific as possible.
    As Above

  2. Reproduction Rate: Indicate how often the bug occurs when following these steps (e.g., "every time", "intermittently: about 50% of the time").
    For us, Every time

Expected Behavior

Describe what you expected to happen.

When the activity completes it should call CompelteAsync() on the response so its flushed to the client
This should happen here:
https://github.com/elsa-workflows/elsa-core/blob/main/src/modules/Elsa.Http/Activities/WriteHttpResponse.cs#L137

Actual Behavior

Describe what actually happened. Include screenshots, if applicable.

It doesn't call that so the response isn't written for sure.

Environment

This is still the case on the main branch:
https://github.com/elsa-workflows/elsa-core/blob/main/src/modules/Elsa.Http/Activities/WriteHttpResponse.cs#L137

@ciaranodonnell ciaranodonnell added the bug Something isn't working label Apr 24, 2024
Copy link

glime-ai bot commented Apr 24, 2024

Based on the context provided, it appears that you are experiencing an issue where the WriteHttpResponse activity in an Elsa Workflow does not immediately flush the response to the HTTP caller, but instead waits until the entire workflow has completed. This behavior is not what you expected, as you would like the HTTP response to be sent as soon as the WriteHttpResponse activity completes, even if there are subsequent activities in the workflow, such as a delay.

This issue has been recognized in the Elsa community, as seen in the GitHub issue discussions. The expected behavior would be for the WriteHttpResponse activity to call CompleteAsync() on the response object to ensure it is flushed to the client immediately after the activity executes.

As of the information provided, this behavior is still present in the main branch of the Elsa GitHub repository. A potential solution would be to modify the WriteHttpResponse activity to include a call to CompleteAsync() or a similar method that would flush the response immediately.

For a more detailed discussion or potential fixes, you may want to follow up on the GitHub issues and discussions related to this topic, or reach out to the maintainers of the Elsa project for assistance.

This comment was generated by Glime.

@jdevillard
Copy link
Contributor

link to #4701

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants