Skip to content

add-data-source fails with "Failed to sanitize string" for tables whose display name is fully non-Latin #363

@Mosh-K

Description

@Mosh-K

Bug

Running:

npx power-apps add-data-source --api-id dataverse --resource-name <table-logical-name> --org-url <org-url>

fails with:

Failed to update database references: Failed to sanitize string <non-Latin-display-name>

for any table whose display name has no ASCII letters/digits (e.g. Hebrew, CJK, Arabic). Generation aborts; no table can be added. (pac code add-data-source fails identically — it has its own copy of the same logic.)

Cause

In @microsoft/power-apps-actions/dist/CodeGen/shared/nameUtils.js, sanitizeName() runs name.replace(/[^a-zA-Z0-9_$]/g, '_') on the table display name and then throws when the result is all underscores. A fully non-Latin display name collapses to ______ → throw. The logical and entity-set names are ASCII and sanitize fine; only the display name triggers it.

Fix

Preserve Unicode letters/digits in the replacer:

name.replace(/[^\p{L}\p{N}_$]/gu, '_')

Related theme to #329 but a distinct failure mode (that's label corruption; this is a hard crash) — not a duplicate.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions