Skip to content

bug: Missing required env vars (TWO_FACTOR_ENCRYPTION_KEY, JWT_ALGORITHM) from backend/.env.example - fresh clones crash on startup #1683

Description

@Siddh2024

Summary

Several env vars referenced in authController.js are missing from backend/.env.example, causing fresh clones to crash on startup.

Missing Variables

  1. TWO_FACTOR_ENCRYPTION_KEY - Crashes on startup
    authController.js (line 15, 24-26) does a module-level throw if this is missing or invalid. This crashes the entire server at import time. Not documented in .env.example.

  2. JWT_ALGORITHM - Undocumented
    Defaults to HS256 but no env.example entry exists.

  3. AUTH_COOKIE_DOMAIN / COOKIE_DOMAIN - Undocumented
    Used for setting cookie domain in production, not mentioned anywhere in .env.example.

Proposed Fix

Add these vars to backend/.env.example with comments.
Replace the module-level throw with graceful startup validation.

Acceptance Criteria

  • TWO_FACTOR_ENCRYPTION_KEY added to .env.example with generation instructions
  • JWT_ALGORITHM added to .env.example
  • AUTH_COOKIE_DOMAIN added to .env.example
  • Module-level throw replaced with friendly startup error

Metadata

Metadata

Assignees

No one assigned

    Labels

    backendIssues related to server-side, database logic or APIsbugSomething isn't workingfrontendIssues related to UI/UX

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions