Skip to content

Improve API error handling in CLI deploy command #4794

@chronark

Description

@chronark

API error handling in the CLI currently prints the raw error response directly to the terminal.

Example output when running a deploy command:

❯ go run . deploy --project-id="proj_5VogF2BSh3aZAFZ6" --context="./demo_api" --api-base-url="http://localhost:7070" --root-key="unkey_8JT24f1meaF3cxzF2WfAhn" --env=production

✘ Failed to upload build context
  => {"meta":{"requestId":"req_5Vogt5YzbRmMDF51"},"error":{"detail":"Missing one of these permissions: ['{ project.**.generate_upload_url []}', '{ project.proj_5VogF2BSh3aZAFZ6.generate_upload_url []}'], have: [...]","status":403,"title":"Insufficient Permissions"}}

Improve this so the CLI surfaces a clearer, more user-friendly error message instead of dumping the full JSON response.

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