ai-chatbot
ai-chatbot copied to clipboard
ai-chatbot does not include instructions for DB migration on local deployments
Database Migration Missing in Localhost Setup
Description
The current README lacks a crucial step for database initialization, causing authentication failures on first setup when running locally.
A similar issue, but was closed without PR change to documentation: https://github.com/vercel/ai-chatbot/issues/450
Current Behavior
Database-related errors when trying to register/login:
Failed to get user from database
POST /register 200
Database migrations need to be run before the application can work properly.
pnpm tsx lib/db/migrate.ts && pnpm run build
Did you tried running db:migrate?
I encountered the same problem, Failed to get user from database
Hey everyone,
After completing the setup, I ran the application, and the sign-in page opened as expected. However, when I try to create a new account, I get an error saying, "Failed to create an account." Any ideas on what might be causing this?
Hi all 👋 there are already 3 existing PRs that are addressing this issue:
- https://github.com/vercel/ai-chatbot/pull/855
- https://github.com/vercel/ai-chatbot/pull/830
- https://github.com/vercel/ai-chatbot/pull/732
@jeremyphilemon any chance we could get one of these PRs merged so that we can close this issue and make it easier for everyone to spin up the project locally?
Cheers
+1 to prioritizing this — without clear migration instructions, most users will hit errors out of the box and give up before trying the chatbot. A quick note about running ts-node migrate.ts (or npm run migrate) would go a long way.
Disappointing to see this is still not addressed.
ps: Thanks @b8zhong for the details
The setup docs list setting DATABASE_URL:
Create a PostgreSQL database and retrieve its connection string to set the DATABASE_URL environment variable in .env.local
The actual ENV variable is POSTGRES_URL:
> npx tsx lib/db/migrate.ts
❌ Migration failed
Error: POSTGRES_URL is not defined
at runMigrate (agent-spike/lib/db/migrate.ts:12:11)
at postgres (agent-spike/lib/db/migrate.ts:28:1)
at Object.<anonymous> (agent-spike/lib/db/migrate.ts:32:2)
at Module._compile (node:internal/modules/cjs/loader:1723:14)
at Object.transformer (agent-spike/node_modules/.pnpm/[email protected]/node_modules/tsx/dist/register-DCnOAxY2.cjs:2:1186)
at Module.load (node:internal/modules/cjs/loader:1458:32)
at Function._load (node:internal/modules/cjs/loader:1275:12)
at TracingChannel.traceSync (node:diagnostics_channel:322:14)
at wrapModuleLoad (node:internal/modules/cjs/loader:234:24)
at cjsLoader (node:internal/modules/esm/translators:311:5)
ELIFECYCLE Command failed with exit code 1.
@dancer Why this is closed as not planned ? Do you think you need to spend hours for searching github issues to simply deploy this template locally ?