Comprehensive troubleshooting guide for all SkillSwap components.
Quick Fix Checklist:
- β
Verify backend is running:
http://YOUR_IP:8080/api/usersin browser - β
Check API URL in
frontend-mobile/src/services/api.js - β Ensure phone and computer are on same Wi-Fi network
- β Check firewall settings (allow port 8080)
- β Test URL in phone browser first
Step-by-Step Solution:
Step 1: Verify Backend is Running
- Open your browser and go to:
http://YOUR_IP:8080/api/users- Replace
YOUR_IPwith your computer's IP (e.g.,http://192.168.1.100:8080/api/users)
- Replace
- You should see JSON data or an empty array
[] - If this doesn't work, your backend isn't running or accessible
Step 2: Configure API URL in Mobile App
- Open
frontend-mobile/src/services/api.js - Find line ~10-11:
const PHYSICAL_DEVICE_IP = 'http://YOUR_IP:8080'; - Replace
YOUR_IPwith YOUR computer's IP address - Make sure line ~15:
const IS_PHYSICAL_DEVICE = true;is set totrue - IMPORTANT: Include
http://prefix and:8080port
Step 3: Find Your Computer's IP Address
Windows:
ipconfigLook for "IPv4 Address" under your active network adapter (usually Wi-Fi or Ethernet)
Mac/Linux:
ifconfig
# or
ip addrLook for your active network interface (usually en0 or wlan0)
Step 4: Test Connection from Phone Browser
- On your phone, open a web browser
- Navigate to:
http://YOUR_IP:8080/api/users - If you see JSON data, the connection works!
- If you get an error, the problem is network/firewall, not the app
Step 5: Check Windows Firewall
- Open Windows Defender Firewall
- Click "Advanced settings"
- Check "Inbound Rules" for port 8080
- If missing, create a new rule:
- Allow TCP port 8080
- Apply to all profiles
Step 6: Verify Same Network
- Phone and computer must be on the same Wi-Fi network
- Not on different networks or VPNs
Common Causes:
- β Wrong IP address in
api.js - β Backend not running
- β Firewall blocking port 8080
- β Phone and computer on different networks
- β Missing
http://prefix in IP address
Solutions:
- Double-check IP address format:
http://192.168.1.100:8080(not192.168.1.100:8080) - Test URL in phone browser first
- Check firewall settings
- Verify backend is running:
mvn spring-boot:run
- Check your Spring Boot backend CORS configuration
- Make sure it allows requests from your mobile app
- Backend CORS config should allow all origins (already configured)
Causes:
- Wrong API endpoint
- Backend route doesn't exist
Solution:
- Check backend controller routes match
/api/users,/api/profiles, etc.
Android Emulator:
- Use:
http://10.0.2.2:8080 - This is automatically configured in the code
iOS Simulator:
- Use:
http://localhost:8080 - This is automatically configured in the code
Physical Device (Android or iOS):
- You need to use your computer's local IP address
- See Step 3 above for finding your IP
- Update
PHYSICAL_DEVICE_IPinfrontend-mobile/src/services/api.js
Problem: The backend is receiving a swipe request but throwing a 500 error, likely due to:
- Null pointer exception when accessing
swipe.getSwiper().getUserId() - User IDs not being properly deserialized
- User objects not being found in the database
Current Request Format:
{
swiper: { userId: 1 },
swipee: { userId: 2 },
isLike: true
}Backend Expectation: The backend code expects:
swipe.getSwiper()to return a User object (not null)swipe.getSwiper().getUserId()to return a Long userId- Then it fetches the full User from the repository
Possible Issues:
- Null swiper/swipee: If Spring doesn't deserialize the nested objects, they could be null
- Wrong data type: userId might be sent as string instead of number
- User not found: The user IDs might not exist in the database
Debugging Steps:
- Check console logs for the exact swipe data being sent
- Verify user IDs are valid numbers (not strings)
- Check backend logs for the actual error message
- Verify both users exist in the database
Solution Applied:
- Added validation to ensure user IDs are numbers
- Added detailed error logging
- Added user-friendly error messages
- Ensured proper data type conversion
Next Steps if Still Failing:
- Check backend server logs for the exact exception
- Verify the user IDs exist in the database
- Test with the web frontend to see if it works there
- Consider modifying backend to add null checks (if possible)
Enable Console Logging: The app logs:
- API URL being used
- Full request URLs
- Detailed error information
Check your Expo/Metro console for these logs.
Test API Endpoints Manually: Try these URLs in your phone's browser:
http://YOUR_IP:8080/api/users- Should return user listhttp://YOUR_IP:8080/api/profiles- Should return profile list
If these work in browser but not in app, it's an app configuration issue.
Example Working Configuration:
// In frontend-mobile/src/services/api.js
const PHYSICAL_DEVICE_IP = 'http://192.168.1.100:8080'; // Your IP
const IS_PHYSICAL_DEVICE = true; // true for physical deviceMake sure:
- β IP address is correct
- β
Includes
http://prefix - β
Includes
:8080port - β Backend is running
- β Same Wi-Fi network
- β Firewall allows port 8080
- This is handled by
setupProxy.js- the error is expected if the backend doesn't serve/manifest.json - The app will continue to work normally
- No action needed
Solution:
# Find what's using port 3000
netstat -ano | findstr :3000
# Kill the process (replace <PID> with the number from above)
taskkill /PID <PID> /FSolution:
# Find what's using port 8080
netstat -ano | findstr :8080
# Kill the process (replace PID with the actual process ID)
taskkill /PID <PID> /FCommon warnings:
useEffectmissing dependencies- Unused variables
Solution:
- These are typically intentional (e.g.,
eslint-disable-next-linecomments) - Can be safely ignored for now
- Or fix by adding proper dependencies or removing unused code
Error: Connection refused or Connection timed out
Solutions:
-
Make sure the database container is running:
docker ps # Should show skillswap-db -
If not running, start it:
docker-compose up -d db
-
Check if PostgreSQL is accessible:
docker exec -it skillswap-db psql -U postgres -d skillswap
If you see errors about tables already existing:
- The schema uses
CREATE TABLE IF NOT EXISTSfor most tables - If you still get errors, you can reset the database:
# Stop and remove the database container and volume docker-compose down -v # Start fresh docker-compose up -d db
Solution: Make sure you're logged in. Go to http://localhost:8080/login.html (web) or use the login screen (mobile) and log in first.
Current Implementation: Both apps are configured to NOT auto-login on startup. They will:
- Clear any stored user data on app load
- Always start at the login screen
- Require users to manually log in
To re-enable auto-login: Uncomment the code in:
frontend-mobile/src/contexts/AuthContext.js(line ~22-40)frontend-web/src/contexts/AuthContext.js(line ~17-35)
See the "Clearing Storage" section in FRONTEND.md for detailed instructions on clearing storage for both mobile and web apps.
-
Check Java version:
java -version # Should be Java 21
-
Clean and rebuild:
.\mvnw.cmd clean compile
-
Check for compilation errors in the console output
-
Verify database is running (see Database Issues above)
Common causes:
- Port 8080 already in use (see above)
- Database not running
- Java version mismatch
- Maven dependencies not installed
Solution:
# Clean and rebuild
.\mvnw.cmd clean compile
# Then run
.\mvnw.cmd spring-boot:runSolution:
# Clear npm cache
npm cache clean --force
# Delete node_modules and package-lock.json
rm -rf node_modules package-lock.json
# Reinstall
npm installIf you see errors about missing modules:
- Make sure you're in the
frontend-mobiledirectory - Run
npm install - Check
package.jsonfor the required dependency - If missing, add it and run
npm installagain
Common errors:
Cannot find module 'babel-preset-expo'Cannot find module 'react-native-worklets/plugin'
Solution:
- Make sure
babel-preset-expois indevDependencies - Make sure
react-native-workletsandreact-native-worklets-coreare independencies - Run
npm install - Clear Metro cache:
npx expo start --clear
-
Check console/terminal for error messages
-
Check backend logs to see if requests are reaching the server
-
Verify prerequisites are installed correctly
-
Try cleaning and rebuilding:
# Web cd frontend-web npm install # Mobile cd frontend-mobile npm install # Backend .\mvnw.cmd clean compile
-
Check network connectivity:
- Test API endpoints in browser
- Verify backend is accessible
- Check firewall settings
- Check the main README: See
README.mdfor setup instructions - Check frontend docs: See
FRONTEND.mdfor frontend-specific information - Check console logs: Look for detailed error messages
- Check backend logs: See if requests are reaching the server
- Test in browser first: Verify API endpoints work before testing in app
- Main README:
README.md- Full project documentation - Frontend Docs:
FRONTEND.md- Frontend setup and configuration - Setup Guide:
SETUP_GUIDE.md- Quick setup instructions
Last Updated: Based on latest troubleshooting experiences