Skip to content

Conversation

@RodrigoRafaelSantos7
Copy link
Contributor

@RodrigoRafaelSantos7 RodrigoRafaelSantos7 commented Oct 6, 2025

Fix: Exclude Anonymous Sign-In Path from Convex Adapter Hook

Summary

Fixed the anonymous plugin issue with the Convex adapter.

Change Made

  • Updated the after hook matcher in src/plugins/convex/index.ts to exclude /sign-in/anonymous from matching.
  • The matcher now checks:
    • ctx.path.startsWith("/sign-in") && !ctx.path.startsWith("/sign-in/anonymous")
    • This ensures anonymous sign-in paths are excluded.

What This Fixes

  • Prevents onLinkAccount from running during sign.anonymous — the Convex plugin’s after hook no longer matches anonymous sign-in paths.
  • Allows the anonymous plugin’s hooks to complete first — the Convex hook won’t run prematurely.
  • Reduces interference with anonymous user management — anonymous sign-in is handled by the anonymous plugin’s own hooks.

Rationale

The fix is minimal and targeted: it only excludes the anonymous sign-in path from the JWT token generation hook, allowing the anonymous plugin to handle its own flow without premature account linking logic.

Quality Assurance

  • No linting errors were introduced.
  • Maintains backward compatibility with all other sign-in methods.

Summary by CodeRabbit

  • Bug Fixes
    • Improved sign-in flow handling by ensuring the anonymous sign-in route is processed independently from the standard sign-in route, preventing unintended routing behavior.

@RodrigoRafaelSantos7
Copy link
Contributor Author

@erquhart Can you check the latest commit. I know this is a bit sloppy but I think this fixes the erros with the anonymous plugin.

@RodrigoRafaelSantos7 RodrigoRafaelSantos7 changed the title fix(Manage Imports): Combined the imports of emailOTP and magicLink with other plugin imports from better-auth/plugins # Fix: Exclude Anonymous Sign-In Path from Convex Adapter Hook Nov 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant