Having a complex Astro config throws "Converting circular structure to JSON" when using Clerk components.
ernestoalejo opened this issue · 5 comments
Preliminary Checks
-
I have reviewed the documentation: https://clerk.com/docs
-
I have searched for existing issues: https://github.com/clerk/javascript/issues
-
I have not already reached out to Clerk support via email or Discord (if you have, no need to open an issue here)
-
This issue is not a question, general help request, or anything other than a bug report directly related to Clerk. Please ask questions in our Discord community: https://clerk.com/discord.
Reproduction
https://stackblitz.com/edit/github-rdq1n6?file=astro.config.mjs
Publishable key
pk_test_YW1hemVkLXR1cmtleS02Mi5jbGVyay5hY2NvdW50cy5kZXYk
Description
Steps to reproduce:
- Initialize a new Astro project with Vue.
- Add Clerk with the official quickstart: https://clerk.com/docs/quickstarts/astro
If the vue plugin, or any other complex enough config, is added before the Clerk plugin runs and reads the config then a Converting circular structure to JSON
throws when trying to use the components.
This occurs because the Astro config is not guaranteed to be JSON serializable here:
This also means that the plugin sees an incomplete vision of the config object depending on when it runs so it's not useful anyway.
From the reproduction:
export default defineConfig({
adapter: node({ mode: 'standalone' }),
output: 'server',
// Works
integrations: [clerk()],
// Works:
// integrations: [clerk(), vue()],
// Doesn't work, circular structure:
// integrations: [vue(), clerk()],
});
Expected behavior:
It works with any Astro config file.
Actual behavior:
Environment
System:
OS: Linux 5.0 undefined
CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Memory: 0 Bytes / 0 Bytes
Shell: 1.0 - /bin/jsh
Binaries:
Node: 18.20.3 - /usr/local/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 10.2.3 - /usr/local/bin/npm
pnpm: 8.15.6 - /usr/local/bin/pnpm
npmPackages:
@astrojs/node: ^8.3.3 => 8.3.3
@astrojs/vue: ^4.5.0 => 4.5.0
@clerk/astro: ^1.2.6 => 1.2.6
astro: ^4.15.4 => 4.15.4
vue: ^3.4.38 => 3.5.3
Apologies for the reopening/closing but the PR fix is merged and should be available in the next release
Still having a bug with the current release. A fix was to reverting back to version 1.0.5.
@bbagherian the fix for this will be available in the next release (1.3.3)
@bbagherian @ernestoalejo These changes were released a few hours ago! I'm going to close this issue out, but feel free to re-open if you're still having issues. Thanks!