Errors

NUXT_AUTH_INVALID_CONFIG_EXPORT: Invalid server auth config export

Export defineServerAuth(...) as the default export of your server auth config.
Example error
[NUXT_AUTH_INVALID_CONFIG_EXPORT] server/auth.config.ts must export default defineServerAuth(...).

Why this happens

The config file loaded, but its default export was not a config factory. A named export or a plain options object does not satisfy the server auth config contract. Development skips schema regeneration and preserves the existing schema; production fails.

How to fix it

Wrap the server auth options in defineServerAuth(...) and export the result as default.

Wrap the options in defineServerAuth() and export the result as default:

server/auth.config.ts
import { defineServerAuth } from '@nuxtjs/better-auth/config'

export default defineServerAuth({
  emailAndPassword: { enabled: true },
})

When using a custom auth.serverConfig path, make this change in the file named by the error.

Verify the fix

Run pnpm exec nuxt prepare. If NuxtHub schema generation is enabled, check that the generated schema includes your configured plugin fields.

See Define server auth configuration or return to the error reference.