Troubleshooting

Frequently Asked Questions

Common issues, troubleshooting steps, and technical solutions for setting up and running your VibeMatch platform.

Server & Database Diagnostics

Error: MongooseServerSelectionError: connect ECONNREFUSED 127.0.0.1:27017

Observed in: Backend console output / PM2 error logs (~/.pm2/logs/server-error.log).

Cause: The backend cannot establish a TCP connection to MongoDB using the connection string defined in your .env file.

Remedy:

  • Open code/.env and inspect the MONGODB_URI variable.
  • If running local MongoDB on Ubuntu: run sudo systemctl status mongod. If inactive, start it with sudo systemctl restart mongod && sudo systemctl enable mongod.
  • If using MongoDB Atlas cloud database: ensure your connection string uses mongodb+srv://..., special characters in passwords are URL-encoded (e.g., @ encoded as %40), and your server's public IP address is added to the Network Access IP Access List in Atlas (or set to 0.0.0.0/0).

Error: EADDRINUSE: address already in use :::3000

Observed in: Terminal when executing npm run dev or pm2 start server.js.

Cause: Another process (or a previous orphaned Node instance) is already listening on the TCP port specified by the PORT variable in .env.

Remedy:

  • Find and terminate the process holding port 3000: sudo fuser -k 3000/tcp or kill -9 $(lsof -t -i:3000).
  • Alternatively, edit code/.env and change PORT=3000 to another unused port, such as PORT=3001 or PORT=8080.

Payments & In-App Purchases

Error: Google Play receipt verification failed: Server is not configured with GOOGLE_SERVICE_ACCOUNT_JSON

Observed in: Backend response when mobile user purchases diamonds on Android (POST /api/payments/native/verify returns HTTP 400).

Cause: The server enforces strict fail-closed receipt validation. Because GOOGLE_SERVICE_ACCOUNT_JSON is empty in your backend .env, no diamonds are credited.

Remedy:

  • Go to Google Cloud Console > IAM & Admin > Service Accounts for your Google Play project.
  • Create a Service Account with Android Publisher permissions and generate a JSON key.
  • Minify the JSON into a single line and add it to your server's code/.env:
    GOOGLE_SERVICE_ACCOUNT_JSON='{"type":"service_account",...}'
  • Restart the Node.js backend: pm2 restart all.

Error: StripeInvalidRequestError: No such price / Invalid API Key

Observed in: Browser network tab when attempting checkout (POST /api/payments/stripe/create-checkout returns HTTP 500).

Cause: Stripe Publishable or Secret keys entered in the Admin Panel have leading/trailing whitespace or test/live mode mismatch.

Remedy:

  • Log in to your VibeMatch Admin Panel: https://yourdomain.com/admin.
  • Navigate to Admin > Settings > Payments.
  • Verify that Stripe Secret Key begins with sk_live_ (or sk_test_) and matches the Stripe Publishable Key (pk_live_ / pk_test_).
  • Click Save Payment Settings and re-test.

Video Chat & WebRTC

Error: DOMException: Permission denied / getUserMedia failed (Black Screen)

Observed in: Browser developer tools console when clicking "Start Matching".

Cause: WebRTC media capture is blocked because the web platform is loaded over an insecure HTTP connection or user camera permissions were denied.

Remedy:

  • HTTPS is Mandatory: WebRTC navigator.mediaDevices.getUserMedia() will strictly throw a security error unless served over valid HTTPS with an SSL certificate. Run certbot --nginx -d yourdomain.com or generate a free SSL via cPanel/GadoHost SSL Manager.
  • In the browser address bar, click the lock/settings icon and ensure Camera and Microphone permissions are toggled to Allow.

Issue: Match found, but video is stuck on black screen or drops after 10 seconds

Observed in: Video session UI: peer stream never displays; WebRTC ICE Connection State switches to failed.

Cause: The two connected peers are behind symmetric NAT or restrictive corporate firewalls that block direct peer-to-peer UDP transmission. A TURN relay server is required.

Remedy:

  • Log in to the Admin Dashboard: /admin.
  • Navigate to Admin > Settings > WebRTC & STUN/TURN.
  • Add your TURN server credentials (e.g., from Twilio Network Traversal or a free Metered TURN account):
    URL: turn:turn.example.com:3478, Username, and Credential.
  • Click Save WebRTC Settings. The backend immediately serves these TURN relays to connected mobile and web clients via GET /api/webrtc/ice-servers.

Authentication & Firebase

Error: FirebaseAuthException: [auth/invalid-credential]

Observed in: Flutter debug console / logcat during Google Sign-In or Phone SMS login.

Cause: The SHA-1 or SHA-256 fingerprint of your debug or release signing keystore is missing from the Firebase Console.

Remedy:

  • In terminal: cd flutter_app/android && ./gradlew signingReport.
  • Copy the SHA-1 fingerprint.
  • In Firebase Console, go to Project Settings > General > Your apps > Android app.
  • Click Add Fingerprint, paste the SHA-1 key, and re-download google-services.json into flutter_app/android/app/google-services.json.