log url on instant-cli errors (#2806) [bump to v1.0.55] - #2806
Conversation
📝 WalkthroughWalkthroughThe CLI info command now includes the resolved base URL in dashboard fetch errors while preserving the original cause. The shared client version is updated from ChangesCLI error diagnostics
Shared version update
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@client/packages/cli/src/commands/info.ts`:
- Around line 36-39: Reuse the existing mapError logic that adds the resolved
dashboard URL context for the later `/dash/apps/...` request as well as the
`/dash/me` request. Update the app-fetch error handling near the dashboard
request so schema and non-InstantHttpError failures are wrapped consistently,
without changing successful responses.
In `@client/packages/cli/src/layer.ts`:
- Line 87: Update the error formatting in layer.ts around the request error
handler so methodAndUrl is included only once: retain it in the structured
prefix or the InstantHttpError message, and remove the duplicate from the other
source while preserving the underlying error message.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: e4261dd0-403d-4f8a-bb6f-e17cf892b3d2
📒 Files selected for processing (2)
client/packages/cli/src/commands/info.tsclient/packages/cli/src/layer.ts
| (e) => | ||
| new Error(`Couldn't get user information (${baseUrl}).`, { | ||
| cause: e, | ||
| }), |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Apply URL context to the app fetch as well.
This mapError only covers /dash/me; the later /dash/apps/... request can still fail without the resolved dashboard URL, especially for schema or non-InstantHttpError failures. Reuse the same error mapping for both dashboard requests.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@client/packages/cli/src/commands/info.ts` around lines 36 - 39, Reuse the
existing mapError logic that adds the resolved dashboard URL context for the
later `/dash/apps/...` request as well as the `/dash/me` request. Update the
app-fetch error handling near the dashboard request so schema and
non-InstantHttpError failures are wrapped consistently, without changing
successful responses.
There was a problem hiding this comment.
the later /dash/apps request can fail but ti will fail as an InstantHttpError which will print the url.
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
ast-grep outline client/packages/cli/src/layer.ts --items all
printf '\n--- InstantHttpError definitions and relevant usage ---\n'
rg -n -C 5 '\bInstantHttpError\b|\bInstantHTTPError\b|function printRedErrors|const printRedErrors|printRedErrors\s*=' client/packages/cli/src
printf '\n--- info command request/error handling ---\n'
sed -n '20,65p' client/packages/cli/src/commands/info.tsLength of output: 9912
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '%s\n' '--- InstantHttpError printer ---'
sed -n '70,110p' client/packages/cli/src/layer.ts
printf '%s\n' '--- HTTP client status-error transformation ---'
sed -n '45,125p' client/packages/cli/src/lib/http.ts
printf '%s\n' '--- Existing dashboard schema error wrappers ---'
rg -n -C 4 'schemaBodyJson\(Dash(App|Me)Response\)|Couldn.t get (user|app) information' client/packages/cli/srcLength of output: 6750
@drew-harris, verified: non-2xx responses do become InstantHttpError, so that path is covered.
The remaining case is a 2xx response that fails schemaBodyJson(DashAppResponse)—for example, malformed JSON or a response that no longer matches the expected dashboard schema. That failure occurs after filterStatusOk and is not an InstantHttpError, so it will not have methodAndUrl.
So the requested wrapping is only needed for that decode-error path; the HTTP-error path is already handled as you described.
You are interacting with an AI system.
b2d3eb6 to
0eb2c9a
Compare
|
View Vercel preview at instant-www-js-drewh-better-logging-jsv.vercel.app. |
c63d6dd to
d7db68d
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@client/packages/cli/src/commands/info.ts`:
- Around line 36-39: Sanitize the baseUrl value before interpolating it into the
error created in the user-information request handler. Reuse the project’s
existing URL-redaction utility if available, ensuring embedded credentials and
token-bearing query parameters are removed while retaining useful URL context;
keep the original URL for the request itself.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 7366d6f1-a0c9-48e4-9fdb-b969ac2c162f
📒 Files selected for processing (2)
client/packages/cli/src/commands/info.tsclient/packages/version/src/version.ts
| (e) => | ||
| new Error(`Couldn't get user information (${baseUrl}).`, { | ||
| cause: e, | ||
| }), |
There was a problem hiding this comment.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
Redact sensitive URL components before logging.
baseUrl may come directly from INSTANT_CLI_API_URI, so interpolating it verbatim can expose embedded credentials or token-bearing query parameters in CLI/CI logs. Log a sanitized URL instead.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@client/packages/cli/src/commands/info.ts` around lines 36 - 39, Sanitize the
baseUrl value before interpolating it into the error created in the
user-information request handler. Reuse the project’s existing URL-redaction
utility if available, ensuring embedded credentials and token-bearing query
parameters are removed while retaining useful URL context; keep the original URL
for the request itself.
Shows the url on errors for the info command. For any InstantHttpError, the url is already part of the error message.