[PR #384] [MERGED] feat: add debug mode with --debug flag and ASC_DEBUG env var #488

Closed
opened 2026-02-26 22:31:11 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/rudrankriyam/App-Store-Connect-CLI/pull/384
Author: @nerdynikhil
Created: 1/31/2026
Status: Merged
Merged: 1/31/2026
Merged by: @rudrankriyam

Base: mainHead: feat/debug-verbose-mode


📝 Commits (4)

  • f4242cf feat: add debug mode with --debug flag and ASC_DEBUG env var
  • e523b8f test: fix debug cmdtest compile errors
  • 95e53a8 fix: harden debug logging and split http flag
  • 5a7a4b5 test: expand debug coverage

📊 Changes

9 files changed (+594 additions, -12 deletions)

View changed files

📝 Agents.md (+1 -0)
📝 README.md (+7 -0)
📝 internal/asc/client_core.go (+105 -0)
internal/asc/client_core_debug_test.go (+150 -0)
📝 internal/asc/client_http.go (+115 -12)
internal/asc/client_http_debug_test.go (+123 -0)
internal/cli/cmdtest/debug_test.go (+76 -0)
📝 internal/cli/shared/shared.go (+16 -0)
📝 internal/config/config.go (+1 -0)

📄 Description

The Problem I Hit

Yesterday I was trying to figure out why my CI pipeline kept failing with authentication errors. The CLI just said
"authentication failed" and... that's it. No URL, no status code details, nothing.

I had no idea if:

  • The JWT was malformed
  • I was hitting the wrong endpoint
  • The API was returning something unexpected
  • Rate limiting was kicking in

I ended up adding fmt.Println statements all over the HTTP client code, rebuilding, and re-running. Super tedious.
This is a common pain point - I've seen similar issues in the repo multiple times where users are like "it doesn't
work" and we have no way to see what's actually happening.

What This Adds

A simple --debug flag that shows you what's going on:

→ HTTP Request method=GET url=https://api.appstoreconnect.apple.com/v1/apps authorization="Bearer [REDACTED]"
← HTTP Response status=401 elapsed=234ms

Boom. Instantly I can see the request is actually going out, what URL it's hitting, and the exact status code.
Would've saved me hours.

Also logs retries which is super helpful when you're getting rate limited:
⟳ Retrying request attempt=1 max_retries=3 delay=1.2s error="rate limited by App Store Connect"

Why You'll Want This

For local dev: Just run asc --debug apps list when something breaks. No more guessing.

For CI/CD: Set ASC_DEBUG=1 in your workflow and you get full request logs in your CI output. Debugging flaky
builds becomes way easier.

For support: When users report issues, ask them to run with --debug and paste the output. Instant visibility
into what's actually failing.

Safety

Authorization headers are sanitized (Bearer [REDACTED]) so you can safely paste debug logs in issues without
leaking credentials.

Try It

asc --debug apps list                                                                                               
# or                                                                                                                
ASC_DEBUG=1 asc builds list --app YOUR_APP_ID                                                                       
                                                                                                                    
Follows the same pattern as --retry-log flag, fully tested, no performance impact when disabled.                    
                                                                                                                    
Happy to adjust anything - just wanted to get this merged because I know I'm not the only one who's struggled with  
this!                                                                                                               

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/rudrankriyam/App-Store-Connect-CLI/pull/384 **Author:** [@nerdynikhil](https://github.com/nerdynikhil) **Created:** 1/31/2026 **Status:** ✅ Merged **Merged:** 1/31/2026 **Merged by:** [@rudrankriyam](https://github.com/rudrankriyam) **Base:** `main` ← **Head:** `feat/debug-verbose-mode` --- ### 📝 Commits (4) - [`f4242cf`](https://github.com/rudrankriyam/App-Store-Connect-CLI/commit/f4242cf1d50d5c660a26fd37441c801f107b904a) feat: add debug mode with --debug flag and ASC_DEBUG env var - [`e523b8f`](https://github.com/rudrankriyam/App-Store-Connect-CLI/commit/e523b8f559faedebaf4e5aa1506ea6a20571b2ca) test: fix debug cmdtest compile errors - [`95e53a8`](https://github.com/rudrankriyam/App-Store-Connect-CLI/commit/95e53a801d7a77d29be7e62dd7c8143539f3b317) fix: harden debug logging and split http flag - [`5a7a4b5`](https://github.com/rudrankriyam/App-Store-Connect-CLI/commit/5a7a4b511e665dd97bab61009a59a22ebd75bac4) test: expand debug coverage ### 📊 Changes **9 files changed** (+594 additions, -12 deletions) <details> <summary>View changed files</summary> 📝 `Agents.md` (+1 -0) 📝 `README.md` (+7 -0) 📝 `internal/asc/client_core.go` (+105 -0) ➕ `internal/asc/client_core_debug_test.go` (+150 -0) 📝 `internal/asc/client_http.go` (+115 -12) ➕ `internal/asc/client_http_debug_test.go` (+123 -0) ➕ `internal/cli/cmdtest/debug_test.go` (+76 -0) 📝 `internal/cli/shared/shared.go` (+16 -0) 📝 `internal/config/config.go` (+1 -0) </details> ### 📄 Description ### The Problem I Hit Yesterday I was trying to figure out why my CI pipeline kept failing with authentication errors. The CLI just said "authentication failed" and... that's it. No URL, no status code details, nothing. I had no idea if: - The JWT was malformed - I was hitting the wrong endpoint - The API was returning something unexpected - Rate limiting was kicking in I ended up adding `fmt.Println` statements all over the HTTP client code, rebuilding, and re-running. Super tedious. This is a common pain point - I've seen similar issues in the repo multiple times where users are like "it doesn't work" and we have no way to see what's actually happening. ### What This Adds A simple `--debug` flag that shows you what's going on: → HTTP Request method=GET url=https://api.appstoreconnect.apple.com/v1/apps authorization="Bearer [REDACTED]" ← HTTP Response status=401 elapsed=234ms Boom. Instantly I can see the request is actually going out, what URL it's hitting, and the exact status code. Would've saved me hours. Also logs retries which is super helpful when you're getting rate limited: ⟳ Retrying request attempt=1 max_retries=3 delay=1.2s error="rate limited by App Store Connect" ### Why You'll Want This **For local dev:** Just run `asc --debug apps list` when something breaks. No more guessing. **For CI/CD:** Set `ASC_DEBUG=1` in your workflow and you get full request logs in your CI output. Debugging flaky builds becomes way easier. **For support:** When users report issues, ask them to run with `--debug` and paste the output. Instant visibility into what's actually failing. ### Safety Authorization headers are sanitized (`Bearer [REDACTED]`) so you can safely paste debug logs in issues without leaking credentials. ### Try It ```bash asc --debug apps list # or ASC_DEBUG=1 asc builds list --app YOUR_APP_ID Follows the same pattern as --retry-log flag, fully tested, no performance impact when disabled. Happy to adjust anything - just wanted to get this merged because I know I'm not the only one who's struggled with this! ``` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-26 22:31:11 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/App-Store-Connect-CLI#488
No description provided.