Common Issues
Welcome to the troubleshooting guide! Having problems? Don't worry - we'll help you fix them!
How to Use This Guide 
- Find your issue category (AWS, Stripe, etc.)
- Look for your specific problem
- Try the solutions in order
- If still stuck, check "Getting More Help"
Before You Start
Always check these basics first:
- Are you connected to the internet?
- Did you save all your changes?
- Are your environment variables set?
- Is your virtual environment activated?
AWS Issues 
Lambda Function Not Deploying
Symptoms:
- Error when trying to deploy to Lambda
- Deployment seems stuck
- Function shows as failed
Solutions:
-
Check Image Architecture
-
Verify IAM Permissions
- Go to IAM in AWS Console
- Check user permissions
- Ensure Lambda execution role exists
- Verify API Gateway permissions
-
Check Function Configuration
- Memory should be at least 128MB
- Timeout should be 30 seconds
- Handler should match your code
API Gateway Not Working
Symptoms: * 403 Forbidden errors * Can't reach your API endpoints * Integration timeout errors
Solutions:
-
Check CORS Settings
- Verify CORS is enabled
- Check allowed methods
- Verify allowed headers
-
Check Route Configuration
- Verify route paths match exactly
- Check integration settings
- Ensure deployment stage is set
-
Test Local vs. Production
Free Tier Concerns
Symptoms:
- Unexpected charges
- Usage warnings
- Service limitations
Solutions:
-
Set Up Billing Alerts
- Go to AWS Billing Dashboard
- Create billing alert
- Set threshold below limits
-
Monitor Usage
- Check Lambda invocations
- Monitor API Gateway calls
- Review CloudWatch logs
Stripe Issues 
Payment Link Not Working
Symptoms:
- QR code doesn't load
- Payment page error
- Invalid URL errors
Solutions:
-
Verify API Key
-
Check Price ID
- Verify price exists in Stripe
- Confirm correct mode (test/live)
- Check price is active
-
Test Creating Link
Webhook Not Receiving Events
Symptoms: * Payments succeed but no credits added * No webhook logs in Stripe * API not receiving notifications
Solutions:
-
Check Webhook Configuration
- Verify endpoint URL
- Check webhook secret
- Confirm selected events
-
Test Locally with Stripe CLI
-
Check API Logs
- Look for webhook requests
- Check for signature errors
- Verify payload processing
MQTT Issues 
Connection Problems
Symptoms:
- Can't connect to MQTT broker
- Connection drops frequently
- SSL/TLS errors
Solutions:
-
Check Credentials
-
Verify SSL/TLS Setup
- Check certificate file exists
- Verify certificate isn't expired
- Confirm correct file path
-
Test Network
- Check firewall settings
- Verify port 8883 is open
- Test broker connection
Messages Not Received
Symptoms:
- Cabinet not getting coin pulse
- Game over signals lost
- Delayed message delivery
Solutions:
-
Check Topic Subscription
- Verify topic patterns
- Check machine ID format
- Confirm subscription active
-
Monitor Message Flow
- Use EMQX dashboard
- Check message delivery
- Verify QoS levels
Game Control Issues 
Credits Not Adding
Symptoms:
- Payment successful but no credits
- Game won't start
- Credit display incorrect
Solutions:
-
Check MQTT Messages
-
Verify Machine ID
- Check payment metadata
- Confirm correct ID format
- Test with known working ID
-
Monitor State Changes
- Check credit counter
- Verify game state
- Look for error messages
Game Won't Start
Symptoms:
- Credits added but game inactive
- Stuck on attract screen
- Controls not responding
- System unresponsive
Solutions:
-
Check Game State
- Verify current mode
- Check credit count
- Monitor MQTT messages
-
Test Controls
- Verify USB connections
- Check control mapping
- Test basic input
Development Issues 
Docker Build Problems
Symptoms:
- Build fails
- Missing dependencies
- Architecture mismatch
Solutions:
-
Check Platform Settings
-
Verify Dependencies
- Check requirements.txt
- Verify Python version
- Confirm all imports
Environment Setup Issues
Symptoms:
- Missing variables
- Import errors
- Configuration problems
Solutions:
-
Check Virtual Environment
-
Verify Environment Variables
Getting More Help 
If you're still stuck:
-
Check Error Messages
- Read the full error text
- Look for specific codes
- Check related logs
-
Gather Information
- Which step failed?
- What changed recently?
- What are the exact errors?
-
Get Help
- Ask your teacher/mentor
- Check service documentation
- Search error messages
Still Need Help?
- Describe the problem clearly
- Share relevant error messages
- Explain what you've tried
- Provide system details
Quick Reference 
Common Terminal Commands
# Check Python version
python --version
# Check Docker version
docker --version
# Test API endpoint
curl http://localhost:5000/status
# Monitor MQTT messages
mosquitto_sub -h broker -p 8883 -t "arcade/machine/+/coinpulse"
Useful Links
Remember: Most problems have simple solutions. Take your time, check the basics, and don't hesitate to ask for help!