Astro DB production build error #260

Closed
opened 2026-03-13 07:40:06 -05:00 by GiteaMirror · 4 comments
Owner

Originally created by @jonaspm on GitHub (Nov 21, 2024).

Describe the bug

Astro DB works while developing, but does not work when built and then previewed.

To Reproduce
Steps to reproduce the behavior:

  1. Create a new Astro project.
  2. Configure Astro DB by following these steps (https://docs.astro.build/en/guides/astro-db)
  3. Configure Better-Auth as per the integration documentation (https://www.better-auth.com/docs/integrations/astro)
  4. Use the drizzleAdapter to reuse Astro DB connection.

image

Expected behavior

No errors. Successful connection.

Screenshots

Page does not load on the browser (Error 500).
Screenshot of internal error:
image

Desktop (please complete the following information):

  • OS: Windows 11 x64
  • Browser: Firefox 132.0.2
  • Version: 0.8.9-beta.2
Originally created by @jonaspm on GitHub (Nov 21, 2024). **Describe the bug** Astro DB works while developing, but does not work when built and then previewed. **To Reproduce** Steps to reproduce the behavior: 1. Create a new Astro project. 2. Configure Astro DB by following these steps (https://docs.astro.build/en/guides/astro-db) 3. Configure Better-Auth as per the integration documentation (https://www.better-auth.com/docs/integrations/astro) 4. Use the drizzleAdapter to reuse Astro DB connection. ![image](https://github.com/user-attachments/assets/07a31a9a-4cf2-4ec1-afcf-cddcbd6c5257) **Expected behavior** No errors. Successful connection. **Screenshots** Page does not load on the browser (Error 500). Screenshot of internal error: ![image](https://github.com/user-attachments/assets/9f1b311d-86d2-4f3b-87c7-69b657fdfac4) **Desktop (please complete the following information):** - OS: Windows 11 x64 - Browser: Firefox 132.0.2 - Version: 0.8.9-beta.2
Author
Owner

@cprcrack commented on GitHub (Feb 9, 2025):

How did you solve the issue? I'm also trying to make Better Auth work with Astro DB.

@cprcrack commented on GitHub (Feb 9, 2025): How did you solve the issue? I'm also trying to make Better Auth work with Astro DB.
Author
Owner

@jonaspm commented on GitHub (Feb 9, 2025):

How did you solve the issue? I'm also trying to make Better Auth work with Astro DB.

The build problem went away by updating to latest better-auth and latest Astro 5

@jonaspm commented on GitHub (Feb 9, 2025): > How did you solve the issue? I'm also trying to make Better Auth work with Astro DB. The build problem went away by updating to latest better-auth and latest Astro 5
Author
Owner

@cprcrack commented on GitHub (Feb 9, 2025):

Amd how did you generate the Session, User, Account and Verification schemas in a way that is Astro DB compatible? Could you share your db/config.ts file?

@cprcrack commented on GitHub (Feb 9, 2025): Amd how did you generate the Session, User, Account and Verification schemas in a way that is Astro DB compatible? Could you share your `db/config.ts` file?
Author
Owner

@jonaspm commented on GitHub (Feb 11, 2025):

Amd how did you generate the Session, User, Account and Verification schemas in a way that is Astro DB compatible? Could you share your db/config.ts file?

import { betterAuth } from 'better-auth';
import { Account, db, Session, User, Verification, } from 'astro:db';
import { drizzleAdapter } from 'better-auth/adapters/drizzle';

export const auth = betterAuth({
    database: drizzleAdapter(db, {
        provider: 'sqlite',
        schema: {
            user: User,
            session: Session,
            account: Account,
            verification: Verification,
        }
    }),
});
@jonaspm commented on GitHub (Feb 11, 2025): > Amd how did you generate the Session, User, Account and Verification schemas in a way that is Astro DB compatible? Could you share your `db/config.ts` file? ```javascript import { betterAuth } from 'better-auth'; import { Account, db, Session, User, Verification, } from 'astro:db'; import { drizzleAdapter } from 'better-auth/adapters/drizzle'; export const auth = betterAuth({ database: drizzleAdapter(db, { provider: 'sqlite', schema: { user: User, session: Session, account: Account, verification: Verification, } }), }); ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#260