Skip to content

publish --dry-run crashes with fatal error when artifacts contain gateway API associations #269

Description

Command that triggered the bug

apiops --publish --dry-run

Expected behavior

Dry-run completes and reports planned PUT/DELETE/SKIP actions; a log-label formatting problem must never abort the publish.

Actual behavior

Error

[ERROR] Fatal error during publish: formatTemplatePath: nameParts[1] is undefined
for template "gateways/{0}/apis/{1}" (nameParts has 1 entries)
    at formatTemplatePath (dist/lib/resource-path.js:43)
    at buildResourceLabel (dist/lib/resource-uri.js:106)
    at generateDryRunReport (dist/services/dry-run-reporter.js:66)

Root Cause

GatewayApi associations are discovered from gateways/{gateway}/apis.json as a single descriptor carrying only the parent gateway's name (one name-part, e.g. ['managed']). Expansion into per-API entries happens later, at PUT time (publishAssociation). However, buildResourceLabel() in src/lib/resource-uri.ts unconditionally formats the log label from the full ARM path template gateways/{0}/apis/{1} (two placeholders), which throws for a one-part descriptor. The throw escapes from logger.info(...) inside the dry-run loop and kills the whole run.

Steps to Reproduce

  1. Extract a service that has at least one gateway with API assignments (produces gateways/<name>/apis.json).
  2. Run apiops publish --dry-run --source <artifacts> ...

apiops CLI version

1.0.1

Environment details

  • apiops-cli 1.0.1
  • Node.js v22.16.0

CI/CD environment

None

Is this bug blocking you?

No

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

close:fixedFixed by a previous PR or releasetype:bugSomething broken

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions