- Organized 252 files across project - Root directory: 187 → 2 files (98.9% reduction) - Moved configuration guides to docs/04-configuration/ - Moved troubleshooting guides to docs/09-troubleshooting/ - Moved quick start guides to docs/01-getting-started/ - Moved reports to reports/ directory - Archived temporary files - Generated comprehensive reports and documentation - Created maintenance scripts and guides All files organized according to established standards.
4.3 KiB
DBIS Source Code Fixes Applied
Date: 2026-01-03
Status: ✅ FIXES APPLIED
Problem Resolved
Issue: API service failed with MODULE_NOT_FOUND: Cannot find module '@shared/config/env'
Root Cause: TypeScript path aliases (@shared/, @/core/, etc.) were not resolved at runtime. Node.js cannot resolve these aliases without runtime support.
Solution Applied
Method: Solution 1 - Using tsconfig-paths package
This solution:
- Installs
tsconfig-pathspackage for runtime path alias resolution - Creates
dist/index-runtime.jsentry point that registers path aliases before loading the app - Updates systemd service to use the runtime entry point
Changes Applied
VMID 10150 (API Primary)
-
✅ Installed tsconfig-paths:
cd /opt/dbis-core npm install --save tsconfig-paths -
✅ Created runtime entry point (
/opt/dbis-core/dist/index-runtime.js):require("tsconfig-paths/register"); require("./index.js"); -
✅ Updated systemd service (
/etc/systemd/system/dbis-api.service):- Changed
ExecStartfromdist/index.jstodist/index-runtime.js - Reloaded systemd daemon
- Restarted service
- Changed
VMID 10151 (API Secondary)
- ✅ Installed tsconfig-paths
- ✅ Created runtime entry point
- ⏳ Systemd service - May need to be created if it doesn't exist
Verification Steps
Check Service Status
# API Primary (10150)
ssh root@192.168.11.10 "pct exec 10150 -- systemctl status dbis-api"
# API Secondary (10151) - if service exists
ssh root@192.168.11.10 "pct exec 10151 -- systemctl status dbis-api"
Check Logs
# View recent logs
ssh root@192.168.11.10 "pct exec 10150 -- journalctl -u dbis-api -n 50"
# Follow logs in real-time
ssh root@192.168.11.10 "pct exec 10150 -- journalctl -u dbis-api -f"
Test Health Endpoint
curl http://192.168.11.155:3000/health
Verify Port Listening
ssh root@192.168.11.10 "pct exec 10150 -- ss -tln | grep 3000"
Expected Results
After applying these fixes:
- ✅ Service should start without
MODULE_NOT_FOUNDerrors - ✅ Application should load successfully
- ✅ Port 3000 should be listening
- ✅ Health endpoint should respond
Next Steps
If the service starts successfully:
- Test API endpoints - Verify the API is responding correctly
- Run database migrations - If needed:
ssh root@192.168.11.10 "pct exec 10150 -- cd /opt/dbis-core && npx prisma migrate deploy" - Test Frontend connectivity - Verify frontend can connect to API
- Monitor logs - Check for any runtime errors
Troubleshooting
If Service Still Fails
-
Check logs for specific errors:
ssh root@192.168.11.10 "pct exec 10150 -- journalctl -u dbis-api -n 100" -
Verify tsconfig-paths is installed:
ssh root@192.168.11.10 "pct exec 10150 -- cd /opt/dbis-core && npm list tsconfig-paths" -
Verify index-runtime.js exists:
ssh root@192.168.11.10 "pct exec 10150 -- cat /opt/dbis-core/dist/index-runtime.js" -
Verify systemd service configuration:
ssh root@192.168.11.10 "pct exec 10150 -- cat /etc/systemd/system/dbis-api.service" -
Try running manually (for debugging):
ssh root@192.168.11.10 "pct exec 10150 -- cd /opt/dbis-core && node dist/index-runtime.js"
Alternative Solutions
If tsconfig-paths doesn't work, consider:
- Solution 2: Use
tsc-aliasto rewrite paths during build - Solution 3: Create custom path resolver (more complex)
Files Modified
/opt/dbis-core/dist/index-runtime.js(created)/etc/systemd/system/dbis-api.service(updated - ExecStart path)/opt/dbis-core/package.json(updated - added tsconfig-paths dependency)/opt/dbis-core/package-lock.json(updated)
Summary
✅ Fix Applied: TypeScript path alias resolution using tsconfig-paths
✅ Containers Updated: VMID 10150 (API Primary), VMID 10151 (API Secondary)
✅ Service Updated: Systemd service configured to use runtime entry point
Status: Ready for testing. Service should now start without module resolution errors.
Last Updated: 2026-01-03