gitroomhq/postiz-app · error · Error
Auth provider ${provider} not found
Error message
Auth provider ${provider} not found What it means
The auth ProvidersManager scans registered provider modules and looks up the one whose metadata `provider` equals the requested provider string. If no module declares that provider identifier, it throws before resolving the implementation from the NestJS moduleRef.
Source
Thrown at apps/backend/src/services/auth/providers/providers.manager.ts:18
import { Injectable } from '@nestjs/common';
import { ModuleRef } from '@nestjs/core';
import { AuthProviderAbstract } from '@gitroom/backend/services/auth/providers.interface';
@Injectable()
export class AuthProviderManager {
constructor(private _moduleRef: ModuleRef) {}
getProvider(provider: string): AuthProviderAbstract {
const metadata =
Reflect.getMetadata('auth-provider', AuthProviderAbstract) || [];
const found = metadata.find(
(m: any) => m.provider === provider
);
if (!found) {
throw new Error(`Auth provider ${provider} not found`);
}
return this._moduleRef.get(found.target, { strict: false });
}
}
View on GitHub (pinned to 0f1647f749)
Solutions
- Check which provider modules are imported in the Auth/Providers module and add the missing provider module
- Verify the provider string matches the metadata exactly (case-sensitive compare against the @Provider('x') decoration)
- Guard the endpoint/controller with an allowed-providers check so unknown values 400 early instead of 500
- If a provider was intentionally removed, remove it from the frontend provider list too
Example fix
// before
@Module({ imports: [AppleProviderModule, GoogleProviderModule] })
class AuthModule {}
// request with provider='discord' -> 'Auth provider discord not found'
// after
@Module({ imports: [AppleProviderModule, GoogleProviderModule, DiscordProviderModule] })
class AuthModule {} Defensive patterns
Strategy: type-guard
Validate before calling
const registered = await providersApi.list(); // or a static list
if (!registered.includes(provider)) {
throw new BadRequestException(`Unsupported provider: ${provider}`);
}
await authService.checkExists({ provider, code, state }); Type guard
const SUPPORTED_PROVIDERS = ['apple', 'google', 'facebook'] as const; const isSupportedProvider = (p: string): p is typeof SUPPORTED_PROVIDERS[number] => (SUPPORTED_PROVIDERS as readonly string[]).includes(p);
Try / catch
try {
await authService.checkExists({ provider, code, state });
} catch (e) {
if (e instanceof Error && e.message.includes('not found')) {
return res.status(400).json({ error: `Unsupported provider ${provider}` });
}
throw e;
} Prevention
- Validate the provider param against the registry before the OAuth flow starts
- Keep the frontend provider list generated from the backend's registered providers
- Register every new provider module in the auth module at integration time
When it happens
Trigger: Calling checkExists/OAuth flow with a provider value that no decorated provider module registers (e.g. 'facebook' when only a subset of provider modules are imported into the AuthModule), or a typo/casing mismatch in the provider param.
Common situations: New provider added to the frontend dropdown but its module isn't registered in the backend auth module; provider string casing mismatch ('Apple' vs 'apple'); conditional compilation/exclusion of provider modules per deployment; stale enum vs registered metadata divergence after a refactor.
Related errors
- Integration not allowed
- Organization not found
- Integration not allowed
- This integration requires an external URL and is not support
- Failed to generate auth URL
AI-assisted analysis of gitroomhq/postiz-app@0f1647f749 (2026-08-27).
Data as JSON: /api/errors/79aa1d0088d2ad26.
Report an issue: GitHub.