Skip to content

void db seed cannot resolve @auth-schema imports in database schemas #872

Open

Description

@karthickeyan-dev

Void 1.10.0 loads seed and schema modules without resolving tsconfig path aliases. A schema importing the generated auth tables through @auth-schema fails with:

Cannot find module '@auth-schema'

This affects schemas that reference auth users through foreign keys.

Reproduction

In a disposable Void project with auth enabled and .void/better-auth-schema.ts generated, configure:

{
  "compilerOptions": {
    "paths": {
      "@auth-schema": ["./.void/better-auth-schema.ts"]
    }
  }
}

Add db/schema.ts:

import { userTable } from '@auth-schema';
import { sqliteTable, text } from 'void/schema-d1';

export const exampleTable = sqliteTable('example', {
  id: text().primaryKey(),
  userId: text()
    .notNull()
    .references(() => userTable.id),
});

Add db/seed.ts:

import { defineSeed } from 'void/seed';
import { exampleTable } from './schema';

export default defineSeed(() => {
  console.log(exampleTable);
});

Run:

pnpm exec void db seed

Expected

Seed and schema modules resolve @auth-schema using the project's configured paths.

Actual

Module loading fails with Cannot find module '@auth-schema'.

Relevant implementation

Both seed and schema loading use importLocalModule() in packages/void/src/cli/db.ts. It creates jiti without alias configuration.

Could the loader resolve the project's tsconfig paths, including aliases such as @auth-schema and @schema, for both seed files and their imported schema modules?

Workaround

Replace the alias with a relative import:

import { userTable } from '../.void/better-auth-schema';

Verification

Reproduced the resolution failure using the installed seed loader's jiti options in an isolated fixture. The relative import succeeds. No application database was reset or seeded.

Environment: Void 1.10.0, Node 26.13.1, macOS.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions