WebSocket Connection Issues
Connection Closed Error
Solution: Instatic/terminal.html (line 95), change the WebSocket protocol from wss:// to ws:// if you’re running the application without SSL/TLS:
Use
wss:// (secure WebSocket) only when running behind HTTPS. For local development with HTTP, use ws://.WebSocket Upgrade Failed
If the WebSocket upgrade fails, check the following:- Ensure the server is accepting WebSocket connections on the correct port
- Verify CORS settings allow your origin (controllers/ssh.go:22)
- Check that the UUID parameter is being passed correctly in the WebSocket URL
- Verify the
CheckOriginfunction in the WebSocket upgrader is configured correctly - Ensure your reverse proxy (if any) is configured to pass WebSocket upgrade headers
Deployment Issues
Database Connection Failed
Solution:-
Verify PostgreSQL is running:
-
Check database permissions:
-
Verify environment variables in docker-compose.yaml:
The database must be created before the application starts. Set
MIGRATE_DB=true to automatically run migrations.Port Already in Use
Error Message:-
Find the process using port 8080:
-
Kill the process or change the port in docker-compose.yaml:
Volume Permissions
Issue: PostgreSQL container fails to start with permission errors Solution: Ensure proper permissions before runningdocker compose up:
Authentication Errors
OAuth Callback Failed
Common Causes:-
Missing OAuth Configuration:
- Ensure
GOOGLE_CLIENT_IDandGOOGLE_CLIENT_SECRETare set in docker-compose.yaml - Ensure
GITHUB_CLIENT_IDandGITHUB_CLIENT_SECRETare set in docker-compose.yaml
- Ensure
-
Incorrect Redirect URL:
- OAuth redirect URL must match exactly:
http://localhost:8080/api/v1/auth/callback - Update in your OAuth provider’s console (Google/GitHub)
- OAuth redirect URL must match exactly:
-
Invalid State Parameter:
- The state parameter must match between the authorization request and callback
- Check that state is being properly generated and validated (controllers/oauth.go:60)
JWT Token Issues
Error: “Error generating JWT token” or “Invalid token” Solution:-
Verify
JWT_SECRETis set in environment variables: -
Check cookie settings in production:
- Set
HttpOnly: truefor security - Set
Secure: truewhen using HTTPS - Ensure
SameSiteis configured correctly
- Set
By default, cookies are set with
HttpOnly: false and Secure: false for development. Change these in production (controllers/oauth.go:121).User Not Found
Error: “Error fetching username from database” Solution: This occurs when OAuth succeeds but user creation fails. Check:- Database connection is active
- User table exists (run migrations with
MIGRATE_DB=true) - Username/email is properly stored during OAuth callback
SSH Connection Problems
Failed to Parse Private Key
Common Causes:-
Invalid Private Key Format:
- Ensure the private key is in OpenSSH format
- Check for extra whitespace or line breaks
-
Passphrase Issues:
- If the key has a passphrase, it must be provided during connection
- Empty passphrase field when key requires one will cause failure
Failed to Create Session
Error Message:- Verify the SSH connection was established successfully
- Check that the remote server allows session creation
- Ensure proper terminal allocation settings (controllers/ssh.go:109)
Connection Timeout
Issue: SSH connection times out when attempting to connect to a machine Checklist:- Verify the hostname and port are correct
- Ensure the target machine is reachable:
- Check firewall rules allow SSH connections
- Verify SSH service is running on the target machine
Encryption and Security Issues
Decryption Failed
Causes:-
Password Mismatch:
- The decryption password doesn’t match the encryption password
- Stored in database, used to encrypt/decrypt private keys
-
Corrupted Data:
- IV (Initialization Vector) or ciphertext was corrupted
- Database encoding issue
- Algorithm: AES-CFB
- Key derivation: PBKDF2-HMAC-SHA256 (10,000 iterations)
- Unique salt and IV per encryption operation
If you forget the password used to encrypt a private key, it cannot be recovered. You’ll need to delete and re-add the machine.
Performance Issues
Slow Terminal Response
Symptoms:- Delayed keystrokes in the web terminal
- Laggy terminal output
-
Check Network Latency:
- WebSocket connections are affected by network latency
- Test connection to the SuSHi server and target machine
-
Terminal Buffer Settings:
- Adjust buffer size in controllers/ssh.go:150 (default: 1024 bytes)
- Larger buffers reduce message frequency but increase latency
-
Heartbeat Configuration:
- Heartbeat messages keep connections alive (controllers/ssh.go:134)
- Adjust frequency if experiencing timeouts
High Memory Usage
Issue: Backend consuming excessive memory Solutions:- Monitor active SSH connections
- Check for connection leaks in the connection map
- Ensure sessions are properly closed when terminals disconnect
- Review log level (set to
InfoorWarningin production instead ofDebug)
Docker and Container Issues
Container Fails to Start
Check logs:- Missing environment variables
- Database not ready when backend starts
- Port conflicts
- Volume permission issues
Database Data Persistence
Issue: Data lost after container restart Solution: Ensure volume is properly mounted in docker-compose.yaml:Logging and Debugging
Enable Debug Logging
Set the log level to Debug in docker-compose.yaml:Debug logging provides detailed information about WebSocket messages, SSH connections, authentication flows, and database operations.
View Real-Time Logs
Common Log Messages
Normal Operations:JWT token: [token]- Successful authenticationConnected to machine successfully- SSH connection establishedSSH connection stored successfully- Connection cached with UUID
No SSH connection found for UUID- Invalid or expired connection IDError reading WebSocket message- Client disconnected or network issueFailed to connect to machine- SSH connection failed
Getting Additional Help
If you’ve tried the solutions above and still experience issues:- Check the GitHub repository for known issues
- Enable debug logging and review the logs for specific error messages
- Open a GitHub issue with:
- Error message and stack trace
- Steps to reproduce
- Environment details (OS, Docker version, etc.)
- Relevant log excerpts