Skip to content

db schema export points to node_modules/.cache path and breaks runtime #832

@onmax

Description

@onmax

Summary

When schema paths come from module hooks and resolve under node_modules/.cache/nuxt/.nuxt/..., the generated @nuxthub/db/schema.mjs can end up as:

export * from "/abs/path/node_modules/.cache/nuxt/.nuxt/better-auth/schema.postgresql.ts"

This absolute cache path is then copied into build output and can fail at runtime (ERR_MODULE_NOT_FOUND) when that cache path is unavailable in deployment environments (e.g. Vercel).

Why this happens

buildDatabaseSchema() currently uses skipNodeModulesBundle: true, so schema sources under node_modules are left as external exports instead of being bundled.

Observed failure

Runtime error points to a missing file like:

  • .../node_modules/.cache/nuxt/.nuxt/better-auth/schema.postgresql.ts

Related

I can provide a minimal repro + patched repro pair (nuxthub-{issue} / nuxthub-{issue}-fix) in a follow-up comment/PR.

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