elsa-workflows / elsa-core

A .NET workflows library
https://v3.elsaworkflows.io/
MIT License
6.3k stars 1.16k forks source link

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

Open SydoxX opened 3 months ago

SydoxX commented 3 months ago

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.

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

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

Log Output

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

glime-ai[bot] commented 3 months ago

Based on the information provided, it seems like you are encountering an issue with dynamic HTTP endpoint paths in Elsa Workflow. When using the getWorkflowInstanceId() function within the path, it is causing unexpected behavior.

To troubleshoot this issue, please ensure the following:

  1. Correct Usage of Expressions: Verify that you are using the correct syntax for expressions in Elsa Workflow. It's possible that the expression ${getWorkflowInstanceId()}/test is not being evaluated as expected.

  2. Workflow Configuration: Check your workflow configuration to ensure that the HTTP Endpoint is configured to handle dynamic paths correctly. You may need to review the documentation on HTTP activities to ensure your setup is correct.

  3. Elsa Version: Ensure that you are using the latest version of Elsa, as there might have been bug fixes related to HTTP endpoints in newer versions.

  4. Logs and Errors: Review any logs or error messages provided by Elsa when you attempt to access the dynamic HTTP endpoint. This can give clues as to what might be going wrong.

  5. Elsa Community and Support: If the issue persists, consider reaching out to the Elsa community or support channels. You can create an issue on the Elsa GitHub repository or ask for help on the Elsa Slack channel.

  6. Test with a Static Path: As a temporary workaround, you could test with a static path to ensure that the rest of your workflow is functioning correctly while you troubleshoot the dynamic path issue.

Unfortunately, without access to the actual workflow and environment, it's difficult to provide a more specific solution. If you can provide more details or clarify the exact behavior and setup, I may be able to offer more targeted advice.

This comment was generated by Glime.