1.9 KiB
API Server Fix Summary
Issues Fixed
1. Syntax Error in soroban-stats.js
Problem: Duplicate code fragment causing SyntaxError: Unexpected token '}'
Location: /api/business-logic/contracts/soroban-stats.js lines 67-76
Fix: Removed duplicate fallback code that was left over from a previous edit
2. Query Parameters Not Being Passed to Route Handlers
Problem: Cannot read properties of undefined (reading 'from') and similar errors
Root Cause: Router was not passing req.query to new-format handlers
Location: /api/api/router.js line 103
Fix: Modified handler invocation to pass query: req.query parameter
// Before:
promise = handler({params, req, res})
// After:
promise = handler({params, query: req.query, req, res})
Files Modified
/api/business-logic/contracts/soroban-stats.js- Removed duplicate code/api/api/router.js- Added query parameter passing
Test Results
✅ API server starts successfully on port 3000
✅ MongoDB connections established
✅ Query parameters now parsed correctly
✅ Transactions endpoint working: /explorer/public/tx/recent
✅ Network stats endpoint working: /explorer/public/network/stats
✅ No more 500 Internal Server Errors for query-based endpoints
Notes
- The purple theme changes made earlier were purely frontend (UI) modifications
- These API issues were pre-existing and unrelated to the color theme changes
- The 404 errors for some asset endpoints (like XLM native) are expected behavior when data is not in MongoDB
- The 503 errors for ledger stream are expected when ledger data is stale (normal for development)
Server Status
- API Server: ✅ Running on port 3000
- MongoDB: ✅ Connected (public, testnet, archive)
- Redis: ⚠️ Not configured (using in-memory cache)
- Elasticsearch: ⚠️ Not configured
- Data Ingestion: ⚠️ Disabled for debugging