Skip to content

Commit 4a87ebf

Browse files
Copilothotlong
andcommitted
Add clarifying comment for authServer null check
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent ba404be commit 4a87ebf

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ export function createAuthPlugin(config: AuthPluginConfig = {}): ObjectStackPlug
101101
// Better-Auth exposes a handler for all auth routes
102102
// The handler expects a Web Request object
103103
context.app.all('/api/auth/*', async (req: any) => {
104+
// Defensive check: ensure authServer is initialized
105+
// This could happen if the handler is called before onEnable completes
104106
if (!authServer) {
105107
throw new Error('Auth server not initialized');
106108
}

0 commit comments

Comments
 (0)