Skip to content

[Bug] ppapiBaseUrl() strips 'Default-' prefix, breaking metadata tools for default environments #406

Description

@piekenpuil

Plugin

power-automate

Plugin Version

2.5.0

Skill / Command

build-flow (also affects any tool that calls ppapiBaseUrl(), e.g. get_connector, get_operation_details, list_connections, search_operations, resolve_entity, pick_or_create_connection)

Bug Description

ppapiBaseUrl() in server/mcp.mjs (~line 27704) strips a leading Default- prefix from the environment ID before deriving the PPAPI hostname:

envId.replace(/^Default-/i, "")

For environments whose ID has the form Default-<guid> (the tenant's default environment), this produces a hostname that does not exist (NXDOMAIN), because the correct host actually keeps the default prefix, just lowercased and without the hyphen.

Example (illustrative, GUID redacted):

  • Env ID: Default-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
  • Hostname produced by current code: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.01.environment.api.powerplatform.com (NXDOMAIN)
  • Correct hostname (confirmed via the Flow API's own error message): defaultxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.01.environment.api.powerplatform.com

Steps to Reproduce

  1. Set the current environment to a tenant's default environment (ID format Default-<guid>).
  2. Call any tool that depends on ppapiBaseUrl(), e.g. get_connector, list_connections, search_operations, resolve_entity, or pick_or_create_connection.

Expected Behavior

The tool resolves the correct PPAPI hostname and returns metadata successfully.

Actual Behavior

All of the above tools fail with ENOTFOUND because the derived hostname is invalid. Workaround: manually set PA_PPAPI_BASE_URL to the correct hostname (with the default prefix retained) — the function does honor that override.

Relevant Logs / Screenshots

ENOTFOUND <bad-host>.01.environment.api.powerplatform.com

Workaround used:

PA_PPAPI_BASE_URL=https://default<redacted-guid-no-hyphens>.01.environment.api.powerplatform.com

Environment

  • OS: Microsoft Windows 11 Pro Insider Preview (10.0.26220 Build 26220)
  • Claude Code version: 2.1.220
  • PAC CLI version: not installed / not on PATH

🤖 This issue was created using the /report-issue skill.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions