Skip to content

fix(ui): resolve Windows path generation bug in openapi-ts resulting in ENOENT errors#15056

Merged
elevatebart merged 2 commits intokestra-io:developfrom
MTarek165:fix/resolve-Windows-path-generation-bug-in-openapi-ts-resulting-in-ENOENT-errors
Mar 13, 2026
Merged

fix(ui): resolve Windows path generation bug in openapi-ts resulting in ENOENT errors#15056
elevatebart merged 2 commits intokestra-io:developfrom
MTarek165:fix/resolve-Windows-path-generation-bug-in-openapi-ts-resulting-in-ENOENT-errors

Conversation

@MTarek165
Copy link
Contributor

Description

This PR fixes a critical cross-platform issue in openapi-ts.config.ts
that prevents Windows users from successfully running npm install and generating the OpenAPI client bundle.

Problem

On Windows environments, running npm run generate:openapi (triggered during npm install postinstall) crashes with the following error:
openapi

Root Cause

The bug occurs due to how new URL(import.meta.url).pathname behaves on Windows. When converting the module's file:// protocol to a path, the native JS URL object yields a string with a leading forward slash before the drive letter (e.g., /E:/kestra/ui/openapi-ts.config.ts).

When Node's path.resolve() combines this with a relative string, it perceives the leading slash as an absolute path from root, prepending the local drive letter again. This results in the illegal double-drive-letter folder path (E:\E:...), crashing the application during the directory mkdir step.

Solution

Replaced the basic URL parsing with Node's native fileURLToPath standard library method. This method correctly interprets the file:// scheme on all host operating systems, ensuring that paths generated on Windows accurately match standard Windows File System conventions.

@github-project-automation github-project-automation bot moved this to To review in Pull Requests Mar 13, 2026
@MilosPaunovic MilosPaunovic added area/frontend Needs frontend code changes kind/external Pull requests raised by community contributors labels Mar 13, 2026
@elevatebart elevatebart merged commit f268ffb into kestra-io:develop Mar 13, 2026
10 checks passed
@github-project-automation github-project-automation bot moved this from To review to Done in Pull Requests Mar 13, 2026
@MTarek165 MTarek165 deleted the fix/resolve-Windows-path-generation-bug-in-openapi-ts-resulting-in-ENOENT-errors branch March 13, 2026 06:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/frontend Needs frontend code changes kind/external Pull requests raised by community contributors

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants