Skip to content

fix: extract logs field from application logs API response - #48

Merged
terry90918 merged 2 commits into
mainfrom
develop
Jul 11, 2026
Merged

fix: extract logs field from application logs API response#48
terry90918 merged 2 commits into
mainfrom
develop

Conversation

@terry90918

Copy link
Copy Markdown
Collaborator

Summary

  • getApplicationLogs treated Coolify's GET /applications/{uuid}/logs response as a bare string, but the real API returns {"logs": "..."} — so truncateLogs() called .split() on an object and threw logs.split is not a function on every application_logs MCP call.
  • Fix extracts .logs from the response; updated existing test mocks that (incorrectly) assumed a bare-string response to match the real API shape; documented the gotcha in CLAUDE.md alongside the other known Coolify API quirks.

Test plan

  • bun run test — 563/563 pass
  • bun run lint / bun run build clean
  • Smoke-tested the fix against a live running application (entire-dev-app) — confirmed getApplicationLogs now returns a proper string instead of throwing

Fixes jurislm/jurislm-tools#120

Coolify's GET /applications/{uuid}/logs returns {"logs": "..."},
not a bare string. getApplicationLogs treated the whole response as
the log text, so downstream truncateLogs() called .split() on an
object and threw "logs.split is not a function" on every call.

Fixes #120
Copilot AI review requested due to automatic review settings July 11, 2026 03:55
@terry90918 terry90918 added the bug Something isn't working label Jul 11, 2026
@terry90918 terry90918 self-assigned this Jul 11, 2026
@coderabbitai

coderabbitai Bot commented Jul 11, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 51 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a0ad3a5f-a37b-462f-9a24-fedb277521e9

📥 Commits

Reviewing files that changed from the base of the PR and between c9aa10f and 6a566c9.

📒 Files selected for processing (3)
  • CLAUDE.md
  • src/__tests__/coolify-client.test.ts
  • src/lib/coolify-client.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch develop

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes CoolifyClient.getApplicationLogs() to match Coolify’s real API response shape for GET /applications/{uuid}/logs, preventing runtime failures in the application_logs MCP tool path.

Changes:

  • Updated getApplicationLogs() to read response.logs from the API response wrapper.
  • Updated unit test mocks that previously assumed a bare-string logs response.
  • Documented the /applications/{uuid}/logs response wrapper in CLAUDE.md under known Coolify API gotchas.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/lib/coolify-client.ts Adjusts getApplicationLogs() to extract the logs field from the API response.
src/tests/coolify-client.test.ts Updates fetch mocks to return { logs: ... } to reflect the real endpoint shape.
CLAUDE.md Documents the logs endpoint wrapper response as a known Coolify API quirk.

Comment thread src/lib/coolify-client.ts Outdated
Address PR #48 review feedback: getApplicationLogs assumed logs is
always a string without checking, silently letting an unrecognized
shape propagate a non-string past this boundary. Mirrors the
normalizeDeploymentsResponse pattern (issue #24): accept the known
{logs: string} shape or a bare string, throw a clear error otherwise.
@terry90918
terry90918 merged commit b03aa27 into main Jul 11, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Coolify MCP plugin: application_logs 拋出 "logs.split is not a function"

2 participants