Issue Summary
When running Comp from source following the README "Development" steps, the NestJS API (apps/api) crashes on startup with a dependency-injection error:
NestJS cannot resolve ApiKeyService for HybridAuthGuard.
The Next.js app andportal start fine and the login page renders, but sign-in is blocked because the auth API never comes up (the browser auth client calls the API on port 3333, which is down).
The module wiring looks correct in source (AuthModule provides and exportsApiKeyService and HybridAuthGuard; SOAModule imports AuthModule), so this appears to be a runtime/build issue rather than a missing provider. I could not find an existing issue or docs describing the supported runtime for apps/api in self-hosting, so I am filing this to clarify the intended setup.
Steps to Reproduce
git clone the repo at tag v3.90.1
bun install
- Create
.env files for packages/db, apps/app, apps/portal, apps/api (DATABASE_URL to an external Postgres 15, AUTH_SECRET/SECRET_KEY, Google OAuth creds, AWS S3 vars)
bun run db:generate for apps/app, `apps/po
- Build the workspace packages:
bunx turbo run build --filter='./packages/*'
- Start the API (
nest start --watch, via the api dev script)
The README lists running the apps from source as the supported development path, and the API is required for authentication, but apps/api does not start on a clean checkout.
Actual Results
The API process crashes on bootstrap:
[NestFactory] Starting Nest application...
[ExceptionHandler] UnknownDependenciesException: Nest can't resolve dependencies of the HybridAuthGuard (?, Reflector). Please make sure that the argument ApiKeyService at index [0] is available
- If ApiKeyService is a provider, is it part of the current SOAModule?
Runtime note: I tried both runtimes and got two
- Under Node: the API fails earlier with
SyntaxError: Unexpected token '<' from a workspace package subpath export (e.g. @trycompai/utils/devices), which appears to resolve to raw TypeScript sour
- Under Bun: it gets past that and fails with the
HybridAuthGuard DI error above, consistent with emitDecoratorMetadata not being applied the way NestJS DI expects.
Expected Results
apps/api starts cleanly on a fresh checkout following the documented dev steps, listens on port 3333, and /api/auth/* responds so that Google sign-in from the app (port 3000) completes.
Technical details
- Tag:
v3.90.1
- Node.js: 20.x
- Bun: 1.3.x
- Postgres: 15 (external)
- OS: Amazon Linux 2023, x86_64 (headless server)
- Relevant source (appears correct):
apps/api/src/auth/hybrid-auth.guard.ts - @Injectable(), constructor (private readonly apiKeyService: ApiKeyService, private readonly reflector: Reflector)
apps/api/src/auth/auth.module.ts - provide ApiKeyServiceandHybridAuthGuard`
apps/api/src/soa/soa.module.ts - imports: [AuthModule]
Questions:
- Is there a required package build step (all workspace subpath exports compiled to JS) before starting the API under Node?
- Is a specific
emitDecoratorMetadata / reflect-metadata / tsconfig setup required that the README does not currently mention?
Evidence
Tested on a clean checkout of v3.90.1 on an external Postgres 15, following the README dev steps above.
- App and portal start and the login page renders self-hosted Comp AI "Get Started with Comp AI" / "Continue with Google" page).
- API startup log shows the
UnknownDependenciesException above.
Issue Summary
When running Comp from source following the README "Development" steps, the NestJS API (
apps/api) crashes on startup with a dependency-injection error:NestJS cannot resolve
ApiKeyServiceforHybridAuthGuard.The Next.js app andportal start fine and the login page renders, but sign-in is blocked because the auth API never comes up (the browser auth client calls the API on port 3333, which is down).
The module wiring looks correct in source (
AuthModuleprovides and exportsApiKeyServiceandHybridAuthGuard;SOAModuleimportsAuthModule), so this appears to be a runtime/build issue rather than a missing provider. I could not find an existing issue or docs describing the supported runtime forapps/apiin self-hosting, so I am filing this to clarify the intended setup.Steps to Reproduce
git clonethe repo at tagv3.90.1bun install.envfiles forpackages/db,apps/app,apps/portal,apps/api(DATABASE_URL to an external Postgres 15, AUTH_SECRET/SECRET_KEY, Google OAuth creds, AWS S3 vars)bun run db:generateforapps/app, `apps/pobunx turbo run build --filter='./packages/*'nest start --watch, via the apidevscript)The README lists running the apps from source as the supported development path, and the API is required for authentication, but
apps/apidoes not start on a clean checkout.Actual Results
The API process crashes on bootstrap:
[NestFactory] Starting Nest application...
[ExceptionHandler] UnknownDependenciesException: Nest can't resolve dependencies of the HybridAuthGuard (?, Reflector). Please make sure that the argument ApiKeyService at index [0] is available
Runtime note: I tried both runtimes and got two
SyntaxError: Unexpected token '<'from a workspace package subpath export (e.g.@trycompai/utils/devices), which appears to resolve to raw TypeScript sourHybridAuthGuardDI error above, consistent withemitDecoratorMetadatanot being applied the way NestJS DI expects.Expected Results
apps/apistarts cleanly on a fresh checkout following the documented dev steps, listens on port 3333, and/api/auth/*responds so that Google sign-in from the app (port 3000) completes.Technical details
v3.90.1apps/api/src/auth/hybrid-auth.guard.ts-@Injectable(), constructor(private readonly apiKeyService: ApiKeyService, private readonly reflector: Reflector)apps/api/src/auth/auth.module.ts-provideApiKeyServiceandHybridAuthGuard`apps/api/src/soa/soa.module.ts-imports: [AuthModule]Questions:
emitDecoratorMetadata/ reflect-metadata / tsconfig setup required that the README does not currently mention?Evidence
Tested on a clean checkout of
v3.90.1on an external Postgres 15, following the README dev steps above.UnknownDependenciesExceptionabove.