twentyhq/twenty

Windows: SDK build generates backslash paths causing `dev --once` upload and `app:install` failures

Open

#22.539 aperta il 4 lug 2026

Vedi su GitHub
 (2 commenti) (0 reazioni) (1 assegnatario)TypeScript (6418 fork)batch import
good first issuesonarly:high

Metriche repository

Star
 (45.808 star)
Metriche merge PR
 (Merge medio 1g 8h) (907 PR mergiate in 30 g)

Descrizione

Description

The Twenty SDK generates Windows backslash paths (\) in the manifest and upload payloads when running on Windows. This causes two failures:

  1. yarn twenty dev --once — All file uploads fail with:

    filePath contains unsafe characters or path traversal
    
  2. yarn twenty app:install — Installation fails with:

    File not found in package: src\logic-functions\render-template.logic-function.mjs
    

    (The tarball contains forward-slash paths, but the server's stored manifest has backslash paths from the initial install.)

Root Cause

Multiple locations in the SDK use path.join() and path.relative() to construct file paths. On Windows, these Node.js functions produce backslash-separated paths. These paths are then sent to the server as-is, where they fail validation.

Affected locations in node_modules/twenty-sdk/dist/:

  • login-rU5te3B6.mjs (the main CLI bundle):

    • KN function (~line 60095): path.relative() produces builtPath with backslashes
    • AF function (~line 62404): path.join() produces builtPath with backslashes
    • kF function (~line 62391): path.join() produces builtPath with backslashes
    • BI function (~line 63327): path.relative() reconverts forward slashes back to backslashes when matching manifest entries
    • MR.uploadFile() (~line 65189): path.relative() produces builtHandlerPath with backslashes
    • yL.uploadFile() (~line 64259): sends builtHandlerPath to the UploadApplicationFile GraphQL mutation — server rejects it
  • Manifest generation (~line 63078-63079): sourceHandlerPath and builtHandlerPath use raw path.relative() output (backslashes on Windows)

  • Front component paths (~line 63108-63109): Same issue with sourceComponentPath and builtComponentPath

Steps to Reproduce

  1. On Windows, create a Twenty app with logic functions and front components
  2. Run yarn twenty dev --once -r <remote> .
  3. Observe all file uploads fail with "filePath contains unsafe characters or path traversal"
  4. Alternatively, run yarn twenty app:publish --private -r <remote> . followed by yarn twenty app:install -r <remote> .
  5. Install fails with "File not found in package: src\logic-functions..."

Suggested Fix

Normalize all paths to forward slashes (/) before sending to the server or including in the manifest. For example:

// Before
builtHandlerPath: r.replace(/\.tsx?$/, ".mjs")

// After  
builtHandlerPath: r.replace(/\.tsx?$/, ".mjs").replace(/\/g, '/')

Apply this normalization at every point where paths are constructed for server communication or manifest storage:

  • KN function: normalize builtPath and sourcePath
  • AF function: normalize builtPath
  • kF function: normalize builtPath
  • BI function: normalize the path.relative() result
  • MR.uploadFile(): normalize builtHandlerPath
  • Manifest generation: normalize sourceHandlerPath, builtHandlerPath, sourceComponentPath, builtComponentPath

Environment

  • OS: Windows 11
  • Node: v24.13.0
  • Twenty SDK: 2.16.0
  • Twenty Server: 2.17.0 (Docker)
  • Package manager: Yarn 4.9.2

Workaround

Currently no clean workaround exists on Windows. The SDK works on macOS/Linux where path.join() and path.relative() use forward slashes natively.

Guida contributor