fix(astro): Log Clerk.load() failures in Astro - #9361
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: 30f88a1 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@clerk/astro
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/electron
@clerk/electron-passkeys
@clerk/eslint-plugin
@clerk/expo
@clerk/expo-google-signin
@clerk/expo-passkeys
@clerk/express
@clerk/fastify
@clerk/hono
@clerk/localizations
@clerk/nextjs
@clerk/nuxt
@clerk/react
@clerk/react-router
@clerk/shared
@clerk/tanstack-react-start
@clerk/testing
@clerk/ui
@clerk/upgrade
@clerk/vue
commit: |
API Changes Report
Summary
No API Changes DetectedAll packages have stable APIs with no detected changes. Report generated by Break Check Last ran on |
📝 WalkthroughWalkthroughThe Astro Clerk initialization catch handler now logs rejected Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
packages/astro/src/internal/__tests__/create-clerk-instance.test.ts (1)
124-128: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winUse a typed Clerk mock for the test setup.
Define a
Pick<BrowserClerk, 'load' | 'addListener'>mock and install it onwindowthrough a typed helper. Remove the repeatedwindow as anycasts from this test file.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/astro/src/internal/__tests__/create-clerk-instance.test.ts` around lines 124 - 128, Update the test setup around the Clerk mock to define a typed Pick<BrowserClerk, 'load' | 'addListener'> object, then install it on window through a typed helper. Replace the repeated window as any casts throughout create-clerk-instance tests while preserving the existing load rejection and listener behavior.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/astro/src/internal/create-clerk-instance.ts`:
- Around line 93-95: Update the rejection handler for clerkJSInstance.load() to
accept unknown values and safely narrow them before accessing stack or message,
while still logging null, undefined, and other non-Error rejection values
without throwing. Add coverage for these non-Error rejection cases.
---
Nitpick comments:
In `@packages/astro/src/internal/__tests__/create-clerk-instance.test.ts`:
- Around line 124-128: Update the test setup around the Clerk mock to define a
typed Pick<BrowserClerk, 'load' | 'addListener'> object, then install it on
window through a typed helper. Replace the repeated window as any casts
throughout create-clerk-instance tests while preserving the existing load
rejection and listener behavior.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository YAML (base), Organization UI (inherited)
Review profile: CHILL
Plan: Pro Plus
Run ID: 8df57982-dce5-4ee2-8a64-e1d8d6737d67
📒 Files selected for processing (3)
.changeset/astro-log-load-errors.mdpackages/astro/src/internal/__tests__/create-clerk-instance.test.tspackages/astro/src/internal/create-clerk-instance.ts
🔗 Linked repositories identified
CodeRabbit considers these linked repositories for cross-repo context during reviews:
clerk/clerk_go(manual)clerk/dashboard(manual)clerk/accounts(manual)clerk/backoffice(manual)clerk/clerk(manual)clerk/clerk-docs(manual)clerk/cloudflare-workers(manual)clerk/clerk-ios(auto-detected)clerk/cli(auto-detected)clerk/clerk-android(auto-detected)
Description
When
clerk.load()failed, the error was thrown away by an empty.catch(). Nothing mounted and nothing showed up in the console, so there was no way to tell what went wrong. Now the error gets logged, same as the Vue and React SDKs do.Fixes #9360
Checklist
pnpm testruns as expected.pnpm buildruns as expected.Type of change