diff --git a/.changeset/soft-dragons-thank.md b/.changeset/soft-dragons-thank.md
new file mode 100644
index 00000000000..17d0fdc6539
--- /dev/null
+++ b/.changeset/soft-dragons-thank.md
@@ -0,0 +1,6 @@
+---
+"@clerk/astro": patch
+---
+
+Change prefix for public env variables to `PUBLIC_`. The previous prefix was `PUBLIC_ASTRO_APP_`.
+- After this change the publishable key from should be set as `PUBLIC_CLERK_PUBLISHABLE_KEY=xxxxx`
diff --git a/integration/presets/astro.ts b/integration/presets/astro.ts
index 5375c7020b5..f9a437e864c 100644
--- a/integration/presets/astro.ts
+++ b/integration/presets/astro.ts
@@ -8,7 +8,7 @@ const clerkLocalizationLocal = `file:${process.cwd()}/packages/localizations`;
const astroNode = applicationConfig()
.setName('astro-node')
.useTemplate(templates['astro-node'])
- .setEnvFormatter('public', key => `PUBLIC_ASTRO_APP_${key}`)
+ .setEnvFormatter('public', key => `PUBLIC_${key}`)
.addScript('setup', 'npm i')
.addScript('dev', 'npm run dev')
.addScript('build', 'npm run build')
diff --git a/packages/astro/src/env.d.ts b/packages/astro/src/env.d.ts
index 1e90b606397..37338fad5a4 100644
--- a/packages/astro/src/env.d.ts
+++ b/packages/astro/src/env.d.ts
@@ -1,21 +1,21 @@
///
({ mode }: /** * Convert the integration params to environment variable in order for be readable from the server */ - ...buildEnvVarFromOption(signInUrl, 'PUBLIC_ASTRO_APP_CLERK_SIGN_IN_URL'), - ...buildEnvVarFromOption(signUpUrl, 'PUBLIC_ASTRO_APP_CLERK_SIGN_UP_URL'), - ...buildEnvVarFromOption(isSatellite, 'PUBLIC_ASTRO_APP_CLERK_IS_SATELLITE'), - ...buildEnvVarFromOption(proxyUrl, 'PUBLIC_ASTRO_APP_CLERK_PROXY_URL'), - ...buildEnvVarFromOption(domain, 'PUBLIC_ASTRO_APP_CLERK_DOMAIN'), - ...buildEnvVarFromOption(domain, 'PUBLIC_ASTRO_APP_CLERK_DOMAIN'), - ...buildEnvVarFromOption(domain, 'PUBLIC_ASTRO_APP_CLERK_DOMAIN'), - ...buildEnvVarFromOption(clerkJSUrl, 'PUBLIC_ASTRO_APP_CLERK_JS_URL'), - ...buildEnvVarFromOption(clerkJSVariant, 'PUBLIC_ASTRO_APP_CLERK_JS_VARIANT'), - ...buildEnvVarFromOption(clerkJSVersion, 'PUBLIC_ASTRO_APP_CLERK_JS_VERSION'), + ...buildEnvVarFromOption(signInUrl, 'PUBLIC_CLERK_SIGN_IN_URL'), + ...buildEnvVarFromOption(signUpUrl, 'PUBLIC_CLERK_SIGN_UP_URL'), + ...buildEnvVarFromOption(isSatellite, 'PUBLIC_CLERK_IS_SATELLITE'), + ...buildEnvVarFromOption(proxyUrl, 'PUBLIC_CLERK_PROXY_URL'), + ...buildEnvVarFromOption(domain, 'PUBLIC_CLERK_DOMAIN'), + ...buildEnvVarFromOption(domain, 'PUBLIC_CLERK_DOMAIN'), + ...buildEnvVarFromOption(domain, 'PUBLIC_CLERK_DOMAIN'), + ...buildEnvVarFromOption(clerkJSUrl, 'PUBLIC_CLERK_JS_URL'), + ...buildEnvVarFromOption(clerkJSVariant, 'PUBLIC_CLERK_JS_VARIANT'), + ...buildEnvVarFromOption(clerkJSVersion, 'PUBLIC_CLERK_JS_VERSION'), __HOTLOAD__: mode === 'hotload', }, diff --git a/packages/astro/src/server/get-safe-env.ts b/packages/astro/src/server/get-safe-env.ts index 11309659830..e3666d664c4 100644 --- a/packages/astro/src/server/get-safe-env.ts +++ b/packages/astro/src/server/get-safe-env.ts @@ -21,16 +21,16 @@ function getContextEnvVar(envVarName: keyof InternalEnv, contextOrLocals: Contex */ function getSafeEnv(context: ContextOrLocals) { return { - domain: getContextEnvVar('PUBLIC_ASTRO_APP_CLERK_DOMAIN', context), - isSatellite: getContextEnvVar('PUBLIC_ASTRO_APP_CLERK_IS_SATELLITE', context) === 'true', - proxyUrl: getContextEnvVar('PUBLIC_ASTRO_APP_CLERK_PROXY_URL', context), - pk: getContextEnvVar('PUBLIC_ASTRO_APP_CLERK_PUBLISHABLE_KEY', context), + domain: getContextEnvVar('PUBLIC_CLERK_DOMAIN', context), + isSatellite: getContextEnvVar('PUBLIC_CLERK_IS_SATELLITE', context) === 'true', + proxyUrl: getContextEnvVar('PUBLIC_CLERK_PROXY_URL', context), + pk: getContextEnvVar('PUBLIC_CLERK_PUBLISHABLE_KEY', context), sk: getContextEnvVar('CLERK_SECRET_KEY', context), - signInUrl: getContextEnvVar('PUBLIC_ASTRO_APP_CLERK_SIGN_IN_URL', context), - signUpUrl: getContextEnvVar('PUBLIC_ASTRO_APP_CLERK_SIGN_UP_URL', context), - clerkJsUrl: getContextEnvVar('PUBLIC_ASTRO_APP_CLERK_JS_URL', context), - clerkJsVariant: getContextEnvVar('PUBLIC_ASTRO_APP_CLERK_JS_VARIANT', context) as 'headless' | '' | undefined, - clerkJsVersion: getContextEnvVar('PUBLIC_ASTRO_APP_CLERK_JS_VERSION', context), + signInUrl: getContextEnvVar('PUBLIC_CLERK_SIGN_IN_URL', context), + signUpUrl: getContextEnvVar('PUBLIC_CLERK_SIGN_UP_URL', context), + clerkJsUrl: getContextEnvVar('PUBLIC_CLERK_JS_URL', context), + clerkJsVariant: getContextEnvVar('PUBLIC_CLERK_JS_VARIANT', context) as 'headless' | '' | undefined, + clerkJsVersion: getContextEnvVar('PUBLIC_CLERK_JS_VERSION', context), apiVersion: getContextEnvVar('CLERK_API_VERSION', context), apiUrl: getContextEnvVar('CLERK_API_URL', context), }; @@ -45,11 +45,11 @@ function getSafeEnv(context: ContextOrLocals) { */ function getClientSafeEnv(context: ContextOrLocals) { return { - domain: getContextEnvVar('PUBLIC_ASTRO_APP_CLERK_DOMAIN', context), - isSatellite: getContextEnvVar('PUBLIC_ASTRO_APP_CLERK_IS_SATELLITE', context) === 'true', - proxyUrl: getContextEnvVar('PUBLIC_ASTRO_APP_CLERK_PROXY_URL', context), - signInUrl: getContextEnvVar('PUBLIC_ASTRO_APP_CLERK_SIGN_IN_URL', context), - signUpUrl: getContextEnvVar('PUBLIC_ASTRO_APP_CLERK_SIGN_UP_URL', context), + domain: getContextEnvVar('PUBLIC_CLERK_DOMAIN', context), + isSatellite: getContextEnvVar('PUBLIC_CLERK_IS_SATELLITE', context) === 'true', + proxyUrl: getContextEnvVar('PUBLIC_CLERK_PROXY_URL', context), + signInUrl: getContextEnvVar('PUBLIC_CLERK_SIGN_IN_URL', context), + signUpUrl: getContextEnvVar('PUBLIC_CLERK_SIGN_UP_URL', context), }; }