medusajs/medusa · critical · Error
Google clientId is required
Error message
Google clientId is required
What it means
The Google auth provider's `validateOptions` runs at startup and requires a `clientId` from a Google OAuth client. Without it the provider cannot start the OAuth flow and Medusa fails to boot.
Source
Thrown at packages/modules/providers/auth-google/src/services/google.ts:42
type InjectedDependencies = {
logger: Logger
}
const GOOGLE_JWKS_URI = "https://www.googleapis.com/oauth2/v3/certs"
const GOOGLE_ISSUERS = ["https://accounts.google.com", "accounts.google.com"]
interface LocalServiceConfig extends GoogleAuthProviderOptions {}
export class GoogleAuthService extends AbstractAuthModuleProvider {
static identifier = "google"
static DISPLAY_NAME = "Google Authentication"
protected config_: LocalServiceConfig
protected logger_: Logger
protected jwks_: JwksClient
static validateOptions(options: GoogleAuthProviderOptions) {
if (!options.clientId) {
throw new Error("Google clientId is required")
}
if (!options.clientSecret) {
throw new Error("Google clientSecret is required")
}
if (!options.callbackUrl) {
throw new Error("Google callbackUrl is required")
}
}
constructor(
{ logger }: InjectedDependencies,
options: GoogleAuthProviderOptions
) {
// @ts-ignore
super(...arguments)
this.config_ = optionsView on GitHub (pinned to 5e06e544a2)
Solutions
- Create an OAuth 2.0 client in Google Cloud Console and set clientId in options from an env var
- Confirm the env var is defined where Medusa runs (local .env and deployment secrets)
Example fix
// before
{ id: 'google', resolve: '@medusajs/auth-google', options: {} }
// after
{ id: 'google', resolve: '@medusajs/auth-google', options: { clientId: process.env.GOOGLE_CLIENT_ID, clientSecret: process.env.GOOGLE_CLIENT_SECRET, callbackUrl: `${process.env.MEDUSA_BACKEND_URL}/auth/google/google/callback` } } Defensive patterns
Strategy: validation
Validate before calling
if (!process.env.GOOGLE_CLIENT_ID) {
throw new Error('GOOGLE_CLIENT_ID is required for the google auth provider')
} Prevention
- Create the OAuth client before enabling the module
- Validate env at deploy time
When it happens
Trigger: Registering auth-google in medusa-config without `clientId` or with an unset GOOGLE_CLIENT_ID env var.
Common situations: Google Cloud OAuth client not created yet, credentials not added to the deployment environment, or env var naming mismatch.
Related errors
- Google clientSecret is required
- Github clientId is required
- Github clientSecret is required
- Google callbackUrl is required
- OIDC engine requires an 'issuer' option
AI-assisted analysis of medusajs/medusa@5e06e544a2 (2026-08-27).
Data as JSON: /api/errors/395255612c1f6c05.
Report an issue: GitHub.