|
| 1 | +# Troubleshooting Guide |
| 2 | + |
| 3 | +This guide covers common issues encountered while developing, building, or running the application. |
| 4 | + |
| 5 | +## 1. SQLite File Permission Errors |
| 6 | +**Symptom**: `Error: SQLITE_CANTOPEN: unable to open database file` when starting the backend. |
| 7 | +**Cause**: The process running the backend does not have write permissions to the directory where the SQLite database file is stored or to the file itself. |
| 8 | +**Fix**: Grant appropriate read/write permissions to the database file and its parent directory. |
| 9 | +```bash |
| 10 | +chmod 755 backend/data |
| 11 | +chmod 644 backend/data/campaigns.db |
| 12 | +``` |
| 13 | + |
| 14 | +## 2. Soroban CLI Version Mismatch |
| 15 | +**Symptom**: `error: Found argument '--network' which wasn't expected` or unexpected CLI behavior when deploying contracts. |
| 16 | +**Cause**: You have an outdated or newer version of the Soroban CLI installed globally that is incompatible with the project's contract scripts. |
| 17 | +**Fix**: Install the specific version of Soroban CLI required by the project using cargo. |
| 18 | +```bash |
| 19 | +cargo install --locked --version 20.0.0 soroban-cli |
| 20 | +``` |
| 21 | + |
| 22 | +## 3. Freighter Connection Issues |
| 23 | +**Symptom**: "Freighter is not installed" or "Connection rejected" in the web application. |
| 24 | +**Cause**: The Freighter browser extension is not installed, the user denied the connection request, or the extension is locked. |
| 25 | +**Fix**: Reset the local network configuration via CLI to ensure proper testnet connections if local accounts are used. |
| 26 | +```bash |
| 27 | +stellar network add --global testnet --rpc-url https://soroban-testnet.stellar.org:443 |
| 28 | +``` |
| 29 | + |
| 30 | +## 4. CORS Errors |
| 31 | +**Symptom**: `Access to fetch at 'http://localhost:8000/api/...' from origin 'http://localhost:3000' has been blocked by CORS policy.` |
| 32 | +**Cause**: The backend server is not configured to allow cross-origin requests from the frontend development server. |
| 33 | +**Fix**: Update your backend environment variables to allow the frontend origin, or restart the backend with CORS enabled. |
| 34 | +```bash |
| 35 | +export CORS_ALLOWED_ORIGINS="http://localhost:3000" |
| 36 | +npm run dev --prefix backend |
| 37 | +``` |
| 38 | + |
| 39 | +## 5. Contract ID Not Set |
| 40 | +**Symptom**: `Error: Contract ID not configured` when attempting to invoke a contract function from the frontend. |
| 41 | +**Cause**: The compiled contract ID is missing from the environment configuration files. |
| 42 | +**Fix**: Rebuild the contracts and copy the generated contract ID into your backend `.env` file. |
| 43 | +```bash |
| 44 | +soroban contract deploy --wasm target/wasm32-unknown-unknown/release/contract.wasm --source account > backend/.env.contract |
| 45 | +``` |
| 46 | + |
| 47 | +## 6. Node Version Mismatch |
| 48 | +**Symptom**: `SyntaxError: Unexpected token '?'` or package installation failures during `npm install`. |
| 49 | +**Cause**: You are using an unsupported version of Node.js. |
| 50 | +**Fix**: Switch to the recommended Node.js version (e.g., v18 or v20) using nvm. |
| 51 | +```bash |
| 52 | +nvm install 18 |
| 53 | +nvm use 18 |
| 54 | +``` |
| 55 | + |
| 56 | +## 7. Docker Daemon Not Running |
| 57 | +**Symptom**: `Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?` |
| 58 | +**Cause**: The Docker background service is not running on your host machine. |
| 59 | +**Fix**: Start the Docker service systemd. |
| 60 | +```bash |
| 61 | +sudo systemctl start docker |
| 62 | +sudo systemctl enable docker |
| 63 | +``` |
| 64 | + |
| 65 | +## 8. Environment Variables Not Loaded |
| 66 | +**Symptom**: Application starts but immediately crashes with missing configuration errors. |
| 67 | +**Cause**: The `.env` file is missing or not being properly sourced in the backend directory. |
| 68 | +**Fix**: Copy the example environment file and populate it. |
| 69 | +```bash |
| 70 | +cp backend/.env.example backend/.env |
| 71 | +``` |
| 72 | + |
| 73 | +## 9. Network Timeout on Testnet |
| 74 | +**Symptom**: `Timeout waiting for transaction confirmation` when interacting with the Stellar Testnet. |
| 75 | +**Cause**: Network congestion or the RPC node is temporarily unreachable. |
| 76 | +**Fix**: Ping the RPC endpoint to check availability. |
| 77 | +```bash |
| 78 | +curl -X POST "https://soroban-testnet.stellar.org:443" -d '{"jsonrpc":"2.0","id":1,"method":"getNetwork"}' |
| 79 | +``` |
| 80 | + |
| 81 | +## 10. Insufficient Funds in Testnet Account |
| 82 | +**Symptom**: `op_underfunded` or `tx_insufficient_balance` when submitting a transaction. |
| 83 | +**Cause**: The account signing the transaction does not have enough XLM to cover the network fees and minimum balance requirements. |
| 84 | +**Fix**: Fund your account using the Stellar Friendbot. |
| 85 | +```bash |
| 86 | +curl "https://friendbot.stellar.org/?addr=YOUR_PUBLIC_KEY" |
| 87 | +``` |
0 commit comments