# Troubleshooting
Common issues and solutions for CloudPOS setup and operation.
# Quick Diagnosis
# Check Services Are Running
# Check API server
curl http://localhost:3000/api
# Check frontend
curl http://localhost:5173
# Check MySQL
mysql -u root -p -e "SELECT 1"
# Check Logs
# PM2 logs (production)
pm2 logs cloudpos
# Server logs
tail -f logs/pm2-error.log
tail -f logs/pm2-out.log
# Nginx logs
sudo tail -f /var/log/nginx/error.log
# Common Issues
# Build Errors
# Error: Cannot find module or Module not found
Cause: Dependencies not installed
Solution:
# Install root dependencies
npm install
# Install server dependencies
cd server && npm install
# Install client dependencies
cd ../client && npm install
# Error: TypeScript errors or Type errors
Cause: TypeScript compilation errors
Solution:
# Check TypeScript version
npm list typescript
# Reinstall TypeScript
npm install typescript@latest --save-dev
# Clean and rebuild
cd server && npm run build
cd ../client && npm run build
# Error: Prisma Client not generated
Cause: Prisma Client missing
Solution:
cd server
npm run prisma:generate
# Blank Page / White Screen
# Frontend shows blank page
Cause: JavaScript errors or API connection issues
Solutions:
Check browser console:
- Open DevTools (F12)
- Check Console tab for errors
- Check Network tab for failed requests
Verify API is running:
curl http://localhost:3000/apiCheck CORS settings:
CORS_ORIGIN=http://localhost:5173Clear browser cache:
- Hard refresh: Ctrl+Shift+R (Windows) or Cmd+Shift+R (Mac)
- Or clear cache in browser settings
Check build output:
cd client npm run build # Check for build errors
# Admin panel blank
Cause: Admin routes not loading
Solutions:
Check URL:
- Should be:
http://localhost:5173/admin/login - Not:
http://localhost:5173/admin(missing /login)
- Should be:
Check admin user exists:
cd server npx ts-node prisma/create-admin.tsCheck API response:
curl http://localhost:3000/api/admin/auth/me
# 404 API Errors
# Error: 404 Not Found for API endpoints
Cause: API route doesn't exist or server not running
Solutions:
Check API server is running:
# Should return response curl http://localhost:3000/apiCheck route exists:
- Verify endpoint URL is correct
- Check API documentation
Check API prefix:
- All routes should start with
/api - Example:
/api/auth/loginnot/auth/login
- All routes should start with
Check server logs:
pm2 logs cloudpos
# CORS Errors
# Error: CORS policy: No 'Access-Control-Allow-Origin' header
Cause: CORS not configured correctly
Solutions:
Check CORS_ORIGIN in
.env:CORS_ORIGIN=http://localhost:5173 # Must match frontend URL exactly (with http://)Restart API server:
# Development: Stop and restart # Production: pm2 restart cloudposCheck for typos:
- No trailing slash
- Include protocol (http:// or https://)
- Match port number
# Database Connection Errors
# Error: Can't reach database server or ECONNREFUSED
Cause: MySQL not running or wrong credentials
Solutions:
Check MySQL is running:
# Windows (Laragon) # Check Laragon dashboard # macOS brew services list # Linux sudo systemctl status mysqlStart MySQL:
# macOS brew services start mysql@8.0 # Linux sudo systemctl start mysqlTest connection:
mysql -u root -p -h localhostCheck DATABASE_URL in
.env:DATABASE_URL="mysql://user:password@localhost:3306/cloudpos"
# Error: Access denied for user
Cause: Wrong username/password or user doesn't exist
Solutions:
Verify credentials:
- Check username and password in
DATABASE_URL - Test with:
mysql -u USER -p
- Check username and password in
Create database user:
CREATE USER 'cloudpos'@'localhost' IDENTIFIED BY 'PASSWORD'; GRANT ALL PRIVILEGES ON cloudpos.* TO 'cloudpos'@'localhost'; FLUSH PRIVILEGES;Check user privileges:
SHOW GRANTS FOR 'cloudpos'@'localhost';
# Migration Errors
# Error: Migration failed or Table already exists
Cause: Database state mismatch
Solutions:
Reset database (⚠️ deletes all data):
cd server npx prisma migrate reset npm run prisma:migratePush schema without migrations:
npm run prisma:db:pushCheck existing tables:
USE cloudpos; SHOW TABLES;
# Payment / Subscription Issues
# Payment succeeds but plan not assigned
Cause: Webhook not configured or failing
Solutions:
Check webhook configuration:
- Stripe Dashboard → Webhooks
- Verify endpoint URL is correct
- Check webhook secret matches
Check webhook events:
- Stripe Dashboard → Webhooks → Select webhook → Events
- Look for failed events
- Check error messages
Manually assign plan:
- Admin Panel → Tenants → Select tenant
- Manually assign plan
Check application logs:
pm2 logs cloudpos | grep -i webhook
# Stripe webhook not receiving events
Cause: Webhook URL not accessible or misconfigured
Solutions:
Verify webhook URL:
- Must be publicly accessible (not localhost in production)
- Must use HTTPS in production
- Must be:
https://yourdomain.com/api/subscriptions/webhook
Test webhook:
- Stripe Dashboard → Webhooks → Send test webhook
- Check if received
Check firewall:
- Allow Stripe IPs
- Check server firewall rules
# Sidebar Not Loading Until Refresh
Cause: Initial data fetch failing or slow
Solutions:
Check API response:
curl http://localhost:3000/api/users/profileCheck browser console:
- Look for failed API requests
- Check for CORS errors
Clear cache and refresh:
- Hard refresh: Ctrl+Shift+R
# Toast Notifications Not Appearing
Cause: Toast library not initialized or CSS missing
Solutions:
Check toast library installed:
cd client npm list react-hot-toastCheck toast container in HTML:
- Should have
<Toaster />component in root
- Should have
Check CSS imports:
- Verify toast CSS is imported
# Google Login Issues
Cause: Firebase/Google credentials not configured
Solutions:
Check Firebase configuration:
- Admin Panel → Settings → System Settings
- Verify Firebase credentials are set
Check Google OAuth setup:
- Google Cloud Console → APIs & Services → Credentials
- Verify OAuth client ID is configured
Check allowed domains:
- Add your domain to authorized domains in Google Console
# Missing Images / Uploads Not Loading
Cause: Upload directory not accessible or wrong path
Solutions:
Check upload directory exists:
ls -la server/uploadsCheck file permissions:
chmod -R 775 server/uploadsCheck Nginx config (production):
location /uploads { alias /var/www/cloudpos/server/uploads; }Check upload path in code:
- Verify upload path matches server configuration
# Permission Issues
# Error: Missing required permission
Cause: User doesn't have required permissions
Solutions:
Check user roles:
- Admin Panel → Users → Select user
- Verify roles are assigned
Check role permissions:
- Admin Panel → Roles → Select role
- Verify permissions are assigned
Assign permissions:
- Admin Panel → Roles → Edit role
- Add required permissions
# Getting More Help
# Check Logs
Application logs:
# PM2 logs
pm2 logs cloudpos --lines 100
# Server error log
tail -f logs/pm2-error.log
# Server output log
tail -f logs/pm2-out.log
Database logs:
# MySQL error log
sudo tail -f /var/log/mysql/error.log
Nginx logs:
# Error log
sudo tail -f /var/log/nginx/error.log
# Access log
sudo tail -f /var/log/nginx/access.log
# Enable Debug Mode
Development:
NODE_ENV=development
Check verbose logs:
- Server logs show more details in development mode
- Browser console shows more errors
# Common Commands
# Restart everything
pm2 restart cloudpos
sudo systemctl restart nginx
# Check service status
pm2 status
sudo systemctl status nginx
sudo systemctl status mysql
# Test database connection
mysql -u root -p -e "SELECT 1"
# Test API
curl http://localhost:3000/api
# Rebuild everything
cd server && npm run build
cd ../client && npm run build
Still stuck? Review the Production Checklist for a complete setup verification.