Skip to content

Troubleshooting Tips

Common issues and their solutions when building Ignis applications.

1. Application Fails to Start

SymptomCauseSolution
App exits immediatelyMissing environment variablesCheck .env file has all required vars (especially APP_ENV_APPLICATION_SECRET, APP_ENV_JWT_SECRET)
Connection error on startupDatabase unreachableVerify APP_ENV_POSTGRES_* values and PostgreSQL is running
Error: listen EADDRINUSEPort already in useChange APP_ENV_SERVER_PORT or stop conflicting process

Quick fix:

bash
# Check if PostgreSQL is running
psql -U postgres -c "SELECT 1;"

# Find process using port 3000
lsof -ti:3000 | xargs kill -9

2. API Endpoint Returns 404

CauseCheckFix
Controller not registeredMissing in application.tsAdd this.controller(MyController) to preConfigure()
Incorrect pathTypo in route pathVerify @controller({ path }) and route path match URL
Wrong base pathMissing /api prefixCheck path.base in application config

Debug routes:

typescript
// In application.ts config
export const appConfigs: IApplicationConfigs = {
  debug: {
    showRoutes: process.env.NODE_ENV !== 'production',
  },
};

This prints all registered routes on startup.

3. Dependency Injection Fails (Binding not found)

CauseExample ErrorFix
Resource not registeredBinding 'services.MyService' not foundAdd this.service(MyService) to preConfigure()
Wrong injection keyKey mismatch or typoUse BindingKeys.build() helper
Wrong namespaceUsing repository instead of serviceCheck correct namespace in @inject

Debug bindings:

typescript
// In postConfigure() method
async postConfigure(): Promise<void> {
  this.logger.info('Available bindings: %s',
    Array.from(this.bindings.keys())
  );
}

4. Authentication Fails (401 Unauthorized)

SymptomCauseSolution
401 Unauthorized on protected routeMissing Authorization headerAdd Authorization: Bearer <token> header
Token expiredJWT past expirationRequest new token from login endpoint
Invalid signatureWrong JWT_SECRETEnsure APP_ENV_JWT_SECRET matches across services
Malformed headerMissing "Bearer " prefixFormat: Bearer eyJhbGc...

Test with curl:

bash
curl -H "Authorization: Bearer YOUR_TOKEN" \
  http://localhost:3000/api/protected-route

5. General Debugging Tips

Enable detailed logging:

typescript
// Increase log verbosity
LoggerFactory.setLevel('debug');

Common debugging commands:

bash
# View application logs
tail -f logs/app.log

# Check TypeScript compilation errors
bun run build

# Validate environment variables
cat .env | grep APP_ENV

Useful debugging patterns:

  • Add console.log() in route handlers to trace execution
  • Use try-catch blocks to catch and log errors
  • Check database queries with Drizzle's logging: { logger: true }

Deep Dive: See Logger Helper for advanced logging configuration.