-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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] Problem with WriteHttpResponse Activity on External Workflow Start #5270
Comments
Based on the information provided and the related issues from the Elsa GitHub repository, it seems that the problem you are experiencing with the In the context of HTTP workflows, the To resolve this issue, you would need to ensure that the For workflows that need to perform actions in the background and then respond to an HTTP request, you might consider splitting the workflow into two parts: one that handles the background processing and another that handles the HTTP response. This way, the HTTP response part of the workflow is only executed in the context of an HTTP request. If you need further assistance with this issue, you may want to reach out to the Elsa community or maintainers for more specific guidance or to check if there have been any updates or workarounds since the last known issues. This comment was generated by Glime. |
Hey, thanks, Glime-AI. But in my case, the workflow is triggered and not resumed. So, a new instance is started, and therefore, a new HttpContext should exist. |
Hello, When you manually start the Workflow, it's using an Http API and so you will have an HttpContext. |
Description
In my scenario, there are two workflows, A and B. A has a cron job that starts B every x minutes. B has no interruptions and is supposed to run continuously every x minutes. Now, my problem is that when the workflow is triggered by A, the WriteHttpResponse activity does not terminate but goes into a suspended state. If I manually start B, this problem does not occur, so I suspect an issue in the interaction between the cron job and the WriteHttpResponse activity.
Steps to Reproduce
The problem can be simplified from two workflows to one. If we create a workflow C that is supposed to be started by a cron job every x minutes and it contains a WriteHttpResponse somewhere, it gets stuck at the WriteHttpResponse, and the workflow remains in a suspended state without progressing. Also, it's worth mentioning that if we don't use a cron activity to start the workflow, i.e., if we execute it manually, the problem does not occur.
What I have tested so far:
Manually starting the workflow: works
Starting the workflow via cron: suspended
Starting the workflow via event: suspended
Attachments
Workflow without cron/ event:
![Screenshot 2024-04-24 072339](https://private-user-images.githubusercontent.com/159249295/325091584-f45308d4-eda8-4895-88aa-90a7c96cccfe.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjE3ODE4MzEsIm5iZiI6MTcyMTc4MTUzMSwicGF0aCI6Ii8xNTkyNDkyOTUvMzI1MDkxNTg0LWY0NTMwOGQ0LWVkYTgtNDg5NS04OGFhLTkwYTdjOTZjY2NmZS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNzI0JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDcyNFQwMDM4NTFaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0yYzU3MmFkNGIyZDM3ZmZmOThmMDU4MmY2OGM2YmU1ZTMwY2ZkZmM5OGUyYjFiY2VlMDI3N2QyZTI3OTZmNjQ4JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.b_83xxqXVXN8MT-SZKjCgGwgduFe_DFNnvNFUg0844w)
Execution:
![Screenshot 2024-04-24 072358](https://private-user-images.githubusercontent.com/159249295/325091629-94a9410b-64f2-4706-ba27-e86f80e41bc7.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjE3ODE4MzEsIm5iZiI6MTcyMTc4MTUzMSwicGF0aCI6Ii8xNTkyNDkyOTUvMzI1MDkxNjI5LTk0YTk0MTBiLTY0ZjItNDcwNi1iYTI3LWU4NmY4MGU0MWJjNy5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1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MwNjc3JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.O6x1S-YVSk3e4a5GDsD4_tih_yaHQt5hMjiDlYf84yM)
Execution:
![Screenshot 2024-04-24 072417](https://private-user-images.githubusercontent.com/159249295/325091762-0a51ec8d-b951-48d7-bd11-3eb419ac07d5.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjE3ODE4MzEsIm5iZiI6MTcyMTc4MTUzMSwicGF0aCI6Ii8xNTkyNDkyOTUvMzI1MDkxNzYyLTBhNTFlYzhkLWI5NTEtNDhkNy1iZDExLTNlYjQxOWFjMDdkNS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNzI0JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDcyNFQwMDM4NTFaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0yNjllZGFlZmQ0Zjg3MmIxZTE4NTc0NTU1ODEzODI3MjU1N2M5YjJhN2U1MTQzM2E5ZjAyODdmN2M4OWNjNDQ0JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.hjVQXvjjHQGHPntiOyS63fBIgeDKm0v45yiLw0syn5c)
Workflow with event:
![Screenshot 2024-04-24 072455](https://private-user-images.githubusercontent.com/159249295/325091816-4b1bd68e-45cd-41e6-8ad0-0693eb21485c.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3M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NTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNzI0JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDcyNFQwMDM4NTFaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT03ZjAwMjFhM2VlMjAzYzMzNDczOTM3M2NmY2Q2YWU0NzgyN2NkMmE1MGVjYzg0OGJhMjZiMmJmNWExOWI5YmQzJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.7zzfoKsML5senimPdIto8UFIwXgOR1PFBbkcrrpcr1Y)
Expected Behavior
I expect the workflow to finish, just as it does without the cron/event.
Actual Behavior
The workflow gets into a suspended state and does not continue.
Related Issues
Issues that I found also have a problem with the WriteHttpResponse:
The issue I mentioned earlier:
The text was updated successfully, but these errors were encountered: