Skip to content

bug: --json output is corrupted when combined with --channel or --destination #180

Description

@robingenz

Describe the bug

In apps:builds:create, the deployment step (triggered by --channel or --destination) runs after the final JSON document has been printed. The delegated apps:deployments:create action then writes its own output to stdout, which lands after the JSON.

Consumers that parse the JSON tail of the command output (for example the cloud-build-action, which extracts it with sed -n '/^{/,$p' | jq) receive invalid input when --json is combined with --channel or --destination, because the JSON document is followed by non-JSON lines.

Steps to reproduce

  1. Run npx @capawesome/cli apps:builds:create --app-id <id> --platform web --channel <channel> --json --yes
  2. Wait for the build to complete.
  3. Observe stdout: the JSON document is printed first, followed by the deployment output.

Expected behavior

The JSON document is the last thing written to stdout so the output tail is always parseable.

Possible fix

Run the deployment delegation before printing the final JSON (mirroring how the share step is ordered), and/or include the deployment result in the JSON output.

Affected code

src/commands/apps/builds/create.ts — the deployment delegation at the end of the action runs after the --json output block.

Metadata

Metadata

Assignees

Labels

bug/fixSomething isn't working

Type

No type

Fields

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