Migrating from the Astro community SDK
In July 2024, we introduced official support for Astro. This migration guide covers converting from the astro-clerk-auth
community SDK to Clerk's official SDK. It covers the breaking changes that were introduced and provides examples on how to resolve them.
Installation
Uninstall the community SDK and install Clerk's new official SDK for Astro.
Breaking Changes
The integration
With the community SDK, you could choose to either hotload Clerk's clerk-js
library or bundle it with your application.
With Clerk's official SDK, clerk-js
is hotloaded by default, and the option to use the bundled clerk-js
variant has been removed.
The following changes are required in your Astro configuration file:
Prefix for environment variables
The prefix for environment variables used in client-side code has been updated to align with Astro's best practices. This change affects all environment variables supported by Clerk.
Astro component export updates
The Astro components have been restructured to provide a more consistent API. The following changes are required to import your Astro components:
Stores
Submodule /stores
was replaced with /client
. The following changes are required to import the stores:
Submodule removal
Submodule /v0
was dropped completely and the previously exported constants are no longer available.
clerkClient
changes
The clerkClient
variable has been deprecated and should now be used as a function that accepts the Astro context.
React components changes
With the community SDK, there were to ways to use a React component inside a .astro
file.
To avoid confusion, the official SDK removes the /components/react
submodule.
To use a React component inside a .jsx
or .tsx
file, update the import path.
Feedback
Last updated on