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

API response includes double slash #6041

Open
wrussell1999 opened this issue Nov 21, 2024 · 1 comment
Open

API response includes double slash #6041

wrussell1999 opened this issue Nov 21, 2024 · 1 comment
Labels
area/backend Needs backend code changes bug Something isn't working

Comments

@wrussell1999
Copy link
Member

Describe the issue

When I executed a flow using the API, I got a response with a URL to Kestra that contained two slashes when only one was needed.

Flow:

id: hello_world
namespace: company.team

inputs:
  - id: greeting
    type: STRING
    defaults: hey

tasks:
  - id: hello
    type: io.kestra.plugin.core.log.Log
    message: "{{ inputs.greeting }}"

API Request made in the terminal:

curl -X POST http://localhost:8084/api/v1/executions/company.team/hello_world

Response given:

{
    "id": "6gTABm82mx5li7tHkgqyNU",
    "namespace": "company.team",
    "flowId": "hello_world",
    "flowRevision": 10,
    "inputs": {
        "greeting": "hey"
    },
    "labels": [
        {
            "key": "system.correlationId",
            "value": "6gTABm82mx5li7tHkgqyNU"
        }
    ],
    "state": {
        "current": "CREATED",
        "histories": [
            {
                "state": "CREATED",
                "date": "2024-11-21T16:35:36.815338221Z"
            }
        ],
        "duration": 0.012298625,
        "startDate": "2024-11-21T16:35:36.815338221Z"
    },
    "originalId": "6gTABm82mx5li7tHkgqyNU",
    "deleted": false,
    "metadata": {
        "attemptNumber": 1,
        "originalCreatedDate": "2024-11-21T16:35:36.815378387Z"
    },
    "url": "http://localhost:8084//ui/executions/company.team/hello_world/6gTABm82mx5li7tHkgqyNU"
}

Specifically the bottom line url has two / after the server URL. It should be:
"url": "http://localhost:8084/ui/executions/company.team/hello_world/6gTABm82mx5li7tHkgqyNU"

Should be a quick fix, and doesn't stop it working - just a minor bug.

Environment

  • Kestra Version: develop OSS 78f5ff2
@wrussell1999 wrussell1999 added bug Something isn't working area/backend Needs backend code changes labels Nov 21, 2024
@wrussell1999 wrussell1999 changed the title API response includes double slashes API response includes double slash Nov 21, 2024
@github-project-automation github-project-automation bot moved this to Backlog in Issues Nov 21, 2024
@benjoEK1337
Copy link
Contributor

hey. The code implementation takes the URL specified in the configuration files (application-{env}.yml or any other way to provide the value) and concats the "/ui" + the rest of the path to that URL. This could be fixed in the code by removing the slash if specified or to tell users to specify the URL without the slash at the end.

Here is the code creating the final URL:

private URI executionUrl(Execution execution) { return URI.create(kestraUrl.orElse("") + "/ui" + (execution.getTenantId() != null ? "/" + execution.getTenantId(): "") + "/executions/" + execution.getNamespace() + "/" + execution.getFlowId() + "/" + execution.getId() ); }

where kestraUrl is fetched from configuration:

@Value("${kestra.url}") private Optional<String> kestraUrl;

So, did you maybe specify in your application-local.yml or anywhere else the environment variable kestra.url as: "http://localhost:8084/"?

@loicmathieu what do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/backend Needs backend code changes bug Something isn't working
Projects
Status: Backlog
Development

No branches or pull requests

2 participants