Errors
NUXT_AUTH_INVALID_PLUGIN_SOURCE: Auth plugin path must be absolute
Resolve plugin file paths before registering them with better-auth:plugins:extend.
Example error
[NUXT_AUTH_INVALID_PLUGIN_SOURCE] Modules must register absolute plugin source paths. Received: ./runtime/auth-plugin.ts
Why this happens
A Nuxt module contributed a relative path through better-auth:plugins:extend. Relative paths depend on the consuming app directory, so the auth module requires each contributor to resolve its own plugin files.
How to fix it
Resolve the plugin source with createResolver(import.meta.url).resolve(...) before registering it.
Resolve the path relative to the module that owns the plugin:
modules/auth-extension.ts
import { createResolver, defineNuxtModule } from '@nuxt/kit'
export default defineNuxtModule({
setup(_options, nuxt) {
const resolver = createResolver(import.meta.url)
nuxt.hook('better-auth:plugins:extend', (plugins) => {
plugins.server ||= []
plugins.server.push(resolver.resolve('./runtime/auth-plugin.ts'))
})
},
})
Use plugins.client for a client auth plugin. The referenced file must exist and export the plugin expected by the auth configuration.
Verify the fix
Run pnpm exec nuxt prepare. The registered path should be absolute and the contributed plugin should appear in the generated auth configuration.
See Configure server auth or return to the error reference.