Skip to content

Auto-increment port on collision. Fixes Node.js EADDRINUSE error.#2

Merged
ertugrulakben merged 1 commit intoertugrulakben:mainfrom
varadfromeast:feature/bug-fix
Mar 16, 2026
Merged

Auto-increment port on collision. Fixes Node.js EADDRINUSE error.#2
ertugrulakben merged 1 commit intoertugrulakben:mainfrom
varadfromeast:feature/bug-fix

Conversation

@varadfromeast
Copy link
Copy Markdown
Contributor

Fixes EADDRINUSE error when starting the dashboard on a busy port. The server now automatically finds the next available port. Added integration test for port collision logic

…oard on a busy port. The server now automatically finds the next available port. Added integration test for port collision logic
const green = chalk.hex('#16C784');
const dim = chalk.dim;

/**
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

unsure if comments are to be kept or not...

Comment thread tests/cli.test.js
});
});

// ─── Dashboard Command Tests ──────────────────────────────────────────
Copy link
Copy Markdown
Contributor Author

@varadfromeast varadfromeast Mar 15, 2026

Choose a reason for hiding this comment

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

test suite was successfully run using npm test

@varadfromeast
Copy link
Copy Markdown
Contributor Author

@ertugrulakben - Hi! I've submitted this PR to fix the EADDRINUSE error. Could you please review when you get a chance? Thanks!

Copy link
Copy Markdown
Owner

@ertugrulakben ertugrulakben left a comment

Choose a reason for hiding this comment

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

Hey @varadfromeast — thanks for taking the time to submit this! The core fix is solid — auto-incrementing the port on EADDRINUSE is the right approach, and the recursive helper with a limit is clean.

A few things to fix before we can merge:

1. Remove .idea/ directory

IDE config files (.idea/*) shouldn't be in the repo. Please remove them from this PR and add .idea/ to your global gitignore:

git rm -r --cached .idea
echo '.idea/' >> .gitignore

2. Revert package-lock.json version change

The lock file shows 1.0.2 → 1.2.0 but package.json wasn't changed in this PR. This was likely generated from an outdated local state. Please revert:

git checkout main -- package-lock.json

3. Clean up comments

  • Remove // CALL THE HELPER HERE (line 45)
  • Remove the trailing // on the startPort line

4. Minor: bin/cashclaw.js mode change

The file mode changed from 100644 to 100755. If intentional (making it executable), that's fine — just confirming.


Once those are cleaned up, happy to merge. Welcome aboard!

@ertugrulakben ertugrulakben merged commit ba819e4 into ertugrulakben:main Mar 16, 2026
ertugrulakben pushed a commit that referenced this pull request Mar 16, 2026
…ntributors

- Removed .idea/ directory (IDE config), added to .gitignore
- Removed stale comments: "// CALL THE HELPER HERE", trailing "//"
- Regenerated package-lock.json with correct version (1.2.1)
- Added Contributors section to README — welcome @varadfromeast!

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@ertugrulakben
Copy link
Copy Markdown
Owner

Merged! Thanks for the contribution @varadfromeast 🎉

I did a small follow-up cleanup in 4920d6a:

  • Removed .idea/ directory and added it to .gitignore
  • Cleaned up the comments
  • Fixed package-lock.json version

You've been added to the Contributors section in the README. Welcome to the team!

If you want to keep contributing, check out the open issues — always happy to review PRs.

@ertugrulakben
Copy link
Copy Markdown
Owner

Hi @awbe-hub 👋

Excellent bug report — thank you for the thorough analysis! You've nailed the root causes. Here's the status on each:

1. ✅ Wallet Page Crash — Confirmed & Fix In Progress

You're exactly right. The wallet UI only handles these transaction types:

  • payment, payout, refund, fee

But the backend sends escrow_release for completed orders. The icon/color mapping crashes when it encounters an unknown type.

Fix: Adding escrow_release (and escrow_hold, withdrawal) to the Transaction type union, icon map, and color map.

2. ✅ Approve Button Fails — Confirmed & Fix In Progress

The completeOrder() function in the API client sends a POST with Content-Type: application/json but no body. Fastify correctly rejects this.

Fix: Adding body: JSON.stringify({}) to completeOrder(), deleteAgent(), and all other POST/DELETE methods that currently send empty bodies.

3. ✅ Deliverables Raw JSON — Confirmed & Fix In Progress

When deliverables are stored as structured objects ({type, content}), the frontend does JSON.stringify(item) instead of extracting the .content field.

Fix: Updating the deliverables renderer to properly extract and display the content from structured objects.

4. ⏳ Stripe Onboarding — Planned

The /v1/payments/stripe/onboard endpoint exists in the API client but the backend route isn't fully implemented yet. The Settings page currently shows "Coming Soon" for Stripe Connect.

Status: This is on the roadmap. For now, platform payouts are handled manually. We'll announce when Stripe Connect onboarding is live.


All fixes (1-3) will be deployed in the next release. I'll update this issue when it's live.

Thanks again for the incredibly detailed report — this is exactly the kind of feedback that makes the platform better! 🙏


🇹🇷 Türkçe:

Merhaba @awbe-hub,

Harika bir bug raporu, teşekkürler! Tüm sorunları doğru tespit etmişsiniz:

  1. Wallet crash: escrow_release transaction tipi frontend'de tanımlı değil → düzeltme geliyor
  2. Approve butonu: Boş body + JSON content-type hatası → body: JSON.stringify({}) ekleniyor
  3. Deliverables: Raw JSON gösteriliyor → içerik doğru şekilde render edilecek
  4. Stripe onboarding: Henüz tam implementasyon yok → roadmap'te, şimdilik "Coming Soon"

1-3 arası düzeltmeler bir sonraki sürümde deploy edilecek. Güncellemeleri bu issue altında paylaşacağım.

ertugrulakben added a commit that referenced this pull request Mar 27, 2026
- Wallet: support escrow_release/escrow_hold/withdrawal transaction types
- Approve/Delete: fix empty body + Content-Type error
- Deliverables: extract content from structured objects
- Backend: custom JSON parser for empty bodies

Fixes #1, #2, #6

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@ertugrulakben
Copy link
Copy Markdown
Owner

Update: Fixes Deployed! (v1.6.1)

All 3 bugs from this report have been fixed and deployed to production:

  1. Wallet page crash — Fixed. Added escrow_release, escrow_hold, and withdrawal transaction types with proper icons and colors. Unknown types now fallback gracefully instead of crashing.

  2. Approve button — Fixed. The API client now ensures POST requests always include {} body, and the backend now accepts empty JSON bodies via a custom content-type parser.

  3. Deliverables rendering — Fixed. Structured objects like {type: "text", content: "..."} now properly extract and display the content field instead of showing raw JSON.

  4. Stripe onboarding — Still planned for a future release. Settings page shows "Coming Soon" for now.

Changes:

Thanks again for the incredible bug report @awbe-hub!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants