Skip to content

Conversation

@itsjxck
Copy link
Contributor

@itsjxck itsjxck commented Feb 13, 2025

Description

Update ClerkMiddlewareOptionsCallback to accept an async function for the use case where you need to go and fetch the options from an external store. I'm unsure whether this is technically a bug or a feature, because the docs imply that it's supposed to work anyway.

Checklist

  • pnpm test runs as expected.
  • pnpm build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

@changeset-bot
Copy link

changeset-bot bot commented Feb 13, 2025

🦋 Changeset detected

Latest commit: c8bf4b8

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@clerk/nextjs Patch

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

@vercel
Copy link

vercel bot commented Feb 13, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
clerk-js-sandbox ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 13, 2025 7:33pm

@itsjxck itsjxck changed the title fix(nextjs): accept async callback for ClerkMiddlewareOptionsCallback fix(nextjs): accept async callback for ClerkMiddlewareOptionsCallback Feb 13, 2025
@LauraBeatris
Copy link
Member

Hey @itsjxck, thanks for the contribution! The ability to provide clerkMiddleware options via a callback with request access was introduced here but it didn't include handling for asynchronous cases

Our docs indeed highlight the use case of fetching options from an external store, so that was missing case from our side!

I'll just run more tests on my side here and will keep you updated

@itsjxck
Copy link
Contributor Author

itsjxck commented Feb 13, 2025

You absolute ⭐ thank you @LauraBeatris !

@LauraBeatris LauraBeatris changed the title fix(nextjs): accept async callback for ClerkMiddlewareOptionsCallback fix(nextjs): Update clerkMiddleware request callback to accept an async function Feb 13, 2025
@LauraBeatris LauraBeatris force-pushed the fix/accept-async-clerk-middleware-options-callback branch from e140d8b to ce8f6ef Compare February 13, 2025 19:30
@LauraBeatris
Copy link
Member

Hey @itsjxck, unfortunately we currently have a CI issue regarding GitHub secrets in which it doesn't get shared with external contributors, and the integration tests are failing here

In order to unblock you, I've extracted the changes into a separate PR: #5154

I'll close this PR, and thanks again for the contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants