diff --git a/.changeset/kadi-env-var-fix.md b/.changeset/kadi-env-var-fix.md new file mode 100644 index 00000000000..806afaa9405 --- /dev/null +++ b/.changeset/kadi-env-var-fix.md @@ -0,0 +1,5 @@ +--- +"@clerk/expo": major +--- + +fix(expo): Make publishableKey prop required and remove env var fallbacks diff --git a/packages/expo/src/provider/ClerkProvider.tsx b/packages/expo/src/provider/ClerkProvider.tsx index cea114a6e43..6c81616a1fc 100644 --- a/packages/expo/src/provider/ClerkProvider.tsx +++ b/packages/expo/src/provider/ClerkProvider.tsx @@ -14,10 +14,17 @@ export type ClerkProviderProps = Omit< 'publishableKey' > & { /** - * Used to override the default EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY env variable if needed. - * This is optional for Expo as the ClerkProvider will automatically use the EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY env variable if it exists. + * Your Clerk publishable key, available in the Clerk Dashboard. + * This is required for React Native / Expo apps. Environment variables inside node_modules + * are not inlined during production builds, so the key must be passed explicitly. + * + * @example + * ```tsx + * const publishableKey = process.env.EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY!; + * + * ``` */ - publishableKey?: string; + publishableKey: string; /** * The token cache is used to persist the active user's session token. Clerk stores this token in memory by default, however it is recommended to use a token cache for production applications. * @see https://clerk.com/docs/quickstarts/expo#configure-the-token-cache-with-expo @@ -53,7 +60,7 @@ export function ClerkProvider(props: ClerkProviderProps { const { - publishableKey = process.env.EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY || process.env.CLERK_PUBLISHABLE_KEY || '', + publishableKey = '', tokenCache = MemoryTokenCache, __experimental_resourceCache: createResourceCache, } = options || {};