Debugging
Debugging Convex + Better Auth
Verbose logging
Backend
Verbose logs from the Better Auth component can be enabled on the component constructor.
export const authComponent = createClient(
components.betterAuth,
{
verbose: true,
}
);Client side
Verbose logs in the client can be enabled on the Convex client constructor.
// Replace this with your framework prefixed environment variable
// for your project's Convex cloud URL
const convexUrl = import.meta.env.PUBLIC_CONVEX_URL as string;
const convex = new ConvexReactClient(convexUrl, {
verbose: true,
});Out of memory
If convex dev, convex deploy, or code push fails with an error like
JavaScript execution ran out of memory (maximum memory usage: 64 MB), try
these steps:
-
Use
registerRoutesLazy()instead ofregisterRoutes()inconvex/http.ts. This defers Better Auth initialization so it doesn't run during route registration. -
Import Better Auth plugins from their subpaths (e.g.,
better-auth/plugins/magic-linkinstead ofbetter-auth/plugins). Subpath imports pull in less code, reducing bundle size and memory usage.convex/auth.ts import { magicLink } from "better-auth/plugins/magic-link"; import { emailOTP } from "better-auth/plugins/email-otp"; -
Generate a debug bundle to see what's being included. The output contains an
isolatefolder (what runs in the Convex runtime) and anodefolder (what runs in Node.js). Check theisolatebundle forconvex/http.tsto see if unexpected dependencies are inflating it.npx convex dev --once --debug-bundle-path /tmp/convex-bundle