Skip to content

Error: Could not resolve #auth/schema #292

@hareland

Description

@hareland

Description

It is not possible to import the generated schema from #auth/schema -> this breaks when you attempt to run npx nuxt db generate

Error:

npx nuxt db generate
ℹ Ensuring database schema is generated...                                                        2:27:01 PM
Error: Build failed with 1 error:

[RESOLVE_ERROR] Error: Could not resolve '#auth/schema' in server/db/schema.ts
   ╭─[ server/db/schema.ts:2:24 ]
   │
 2 │ import { schema } from '#auth/schema'
   │                        ───────┬──────  
   │                               ╰──────── Matched alias not found for '#auth/schema'
   │ 
   │ Help 1: May be you expected `resolve.alias` to call other plugins resolveId hook? see the docs https://rolldown.rs/apis/config-options#resolve-alias for more details
   │ 
   │ Help 2: 'server/db/schema.ts' is imported by the following path:
   │           - server/db/schema.ts
   │           - .nuxt/hub/db/schema.entry.ts
───╯

    at aggregateBindingErrorsIntoJsError (file:///Users/<readacted>/Workspace/personal/<readacted>/nuxt-app-name/node_modules/.pnpm/[email protected]/node_modules/rolldown/dist/shared/bindingify-input-options-B8B4dvr-.mjs:61:18)
    at unwrapBindingResult (file:///Users/<readacted>/Workspace/personal/<readacted>/nuxt-app-name/node_modules/.pnpm/[email protected]/node_modules/rolldown/dist/shared/bindingify-input-options-B8B4dvr-.mjs:31:128)
    at #build (file:///Users/<readacted>/Workspace/personal/<readacted>/nuxt-app-name/node_modules/.pnpm/[email protected]/node_modules/rolldown/dist/shared/rolldown-build--qygLwCL.mjs:2269:34)
    at async build (file:///Users/<readacted>/Workspace/personal/<readacted>/nuxt-app-name/node_modules/.pnpm/[email protected]/node_modules/rolldown/dist/index.mjs:28:22)
    at async Promise.all (index 0)
    at async buildSingle (file:///Users/<readacted>/Workspace/personal/<readacted>/nuxt-app-name/node_modules/.pnpm/[email protected][email protected][email protected][email protected]_/node_modules/tsdown/dist/src-DrqLE2Pt.mjs:995:19)
    at async Promise.all (index 0)
    at async build$1 (file:///Users/<readacted>/Workspace/personal/<readacted>/nuxt-app-name/node_modules/.pnpm/[email protected][email protected][email protected][email protected]_/node_modules/tsdown/dist/src-DrqLE2Pt.mjs:944:18)
    at async buildDatabaseSchema (file:///Users/<readacted>/Workspace/personal/<readacted>/nuxt-app-name/node_modules/.pnpm/@[email protected][email protected]_@[email protected]_@[email protected]_drizzl_0a4fb5f79dad428fd3b489c9beb8f3f3/node_modules/@nuxthub/core/dist/db/lib/build.mjs:65:3)
    at async Object.run (file:///Users/<readacted>/Workspace/personal/<readacted>/nuxt-app-name/node_modules/.pnpm/@[email protected][email protected]_@[email protected]_@[email protected]_drizzl_0a4fb5f79dad428fd3b489c9beb8f3f3/node_modules/@nuxthub/core/cli/commands/db/generate.mjs:51:5) {
  errors: [Getter/Setter]
} 

server/db/schema.ts

import { sqliteTable, text, integer } from 'drizzle-orm/sqlite-core'
import { schema } from '#auth/schema'

export const dashboards = sqliteTable('dashboards', {
  id: text('id').primaryKey(),
  name: text('name').notNull(),
  description: text('description'),
  createdAt: integer('created_at', { mode: 'timestamp' }).$defaultFn(() => new Date()),
  updatedAt: integer('updated_at', { mode: 'timestamp' }).$onUpdateFn(() => new Date()),
})

export const usersDashboards = sqliteTable('users_dashboards', {
  userId: text('user_id').references(() => schema.user.id),
  dashboardId: text('dashboard_id').references(() => dashboards.id),
  role: text('role', { enum: ['owner', 'admin', 'user'] }).default('user'),
  createdAt: integer('created_at', { mode: 'timestamp' }).$defaultFn(() => new Date()),
  updatedAt: integer('updated_at', { mode: 'timestamp' }).$onUpdateFn(() => new Date()),
})

npx nuxt info:

Operating system macOS 25.3.0
CPU Apple M1 Pro (8 cores)
Node.js version v24.6.0
nuxt/cli version 3.34.0
Package manager [email protected]
Nuxt version 4.4.2
Nitro version 2.13.1
Builder [email protected]
Config auth, compatibilityDate, content, css, devtools, eslint, hub, modules, routeRules, vite
Modules @nuxt/[email protected], @nuxthub/[email protected], @nuxt/[email protected], @nuxt/[email protected], @nuxt/[email protected], @nuxt/[email protected], @nuxt/[email protected], @nuxtjs/[email protected], @nuxtjs/[email protected], @onmax/[email protected]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions