ai-chatbot icon indicating copy to clipboard operation
ai-chatbot copied to clipboard

Installation Guide is Incomplete, Create Neon, then no instructions on setting up tables, users, user logging.

Open ckizer opened this issue 10 months ago • 7 comments

The installation guide stops half way through. You can start up the project, and figure out you need to create a neon database, but it doesn't give you any of the tables needed to create user logins.

I'm trying to run this localhost, and this project should be marked incomplete. After following install instructions you can't get past a registration screen.

I followed the instructions exactly

ckizer avatar Feb 02 '25 06:02 ckizer

this shit sucks

icycyborg avatar Feb 02 '25 19:02 icycyborg

https://github.com/vercel/ai-chatbot/issues/731

icycyborg avatar Feb 02 '25 19:02 icycyborg

https://claude.site/artifacts/f61c63b3-3932-42ee-a87c-591a1c267de0 for reference this is what worked for me

Local Development Setup Guide

Prerequisites

  • Node.js installed
  • pnpm installed
  • A Vercel account

Initial Setup

  1. Clone the repository and install dependencies:
pnpm install
  1. Set up your environment variables:
    • Create a .env file in the root directory
    • Generate an Auth.js secret:
    npx auth secret
    
    • Add the secret to your .env:
    AUTH_SECRET="your-generated-secret"
    

Database Setup

  1. Create a new project on Vercel and link it:
vercel link
  1. Set up Postgres and Blob storage:

    • Go to your Vercel project dashboard
    • Navigate to the "Storage" tab
    • Create a new Postgres database
    • Add Blob storage
  2. Pull the environment variables:

vercel env pull

This will add database-related environment variables to your .env file.

Database Migration

  1. Run the database migrations:
pnpm tsx lib/db/migrate.ts && pnpm run build

If you encounter any errors about existing tables or foreign key constraints:

  1. Drop existing tables either through a database client or Prisma Studio
  2. Run the migrations again

Running the Application

Start the development server:

pnpm run dev

The application should now be running at http://localhost:3000 (or 3001 if 3000 is in use).

Troubleshooting

Database Issues

If you encounter database-related errors:

  1. Ensure all environment variables are properly set in your .env file
  2. Check that the database tables are properly created
  3. If needed, drop all tables and rerun migrations

Authentication Issues

If you encounter authentication errors:

  1. Verify your AUTH_SECRET is properly set
  2. Ensure the database migrations have run successfully
  3. Check that your database connection is working

Known Issues

  • Port 3000 might be in use; the app will automatically try port 3001
  • Initial database setup might require dropping existing tables if migrations fail

Note About AI Models

This template uses Vercel's AI SDK which provides access to AI models without requiring individual API keys. The models are available through Vercel's infrastructure during development.

kanodiaayush avatar Feb 16 '25 01:02 kanodiaayush

@kanodiaayush Thinks for your guide, but I'm still have trouble:

⏳ Running migrations...
❌ Migration failed
Error: write CONNECT_TIMEOUT ep-super-<xxx>.aws.neon.tech:5432
    at connectTimedOut (/ai-chatbot/node_modules/.pnpm/[email protected]/node_modules/postgres/cjs/src/connection.js:257:20)
    at Timeout.done [as _onTimeout] (ai-chatbot/node_modules/.pnpm/[email protected]/node_modules/postgres/cjs/src/connection.js:1033:8)
    at listOnTimeout (node:internal/timers:575:11)
    at process.processTimers (node:internal/timers:514:7) {
  code: 'CONNECT_TIMEOUT',
  errno: 'CONNECT_TIMEOUT',
  address: 'ep-super-<xxx>.aws.neon.tech',
  port: 5432
}

ulivz avatar Feb 16 '25 12:02 ulivz

Ulivz, ran into the same issues, but eventually got it working with these steps:

On Neon: DROP SCHEMA public CASCADE; CREATE SCHEMA public;

Then on local: pnpm db:migrate

Then started the server locally with pnpm dev, and was able to go to http://localhost:3000/ and sign In with a new account, entering both username and password.

rtugo avatar Feb 21 '25 02:02 rtugo

❌ Migration failed Error: POSTGRES_URL is not defined at runMigrate (D:\project\ai-chatbot\lib\db\migrate.ts:12:11) at postgres (D:\project\ai-chatbot\lib\db\migrate.ts:28:1) at Object. (D:\project\ai-chatbot\lib\db\migrate.ts:32:2) at Module._compile (node:internal/modules/cjs/loader:1562:14) at Object.transformer (D:\project\ai-chatbot\node_modules.pnpm\[email protected]\node_modules\tsx\dist\register-DCnOAxY2.cjs:2:1186)

ilses1 avatar Feb 26 '25 11:02 ilses1

https://claude.site/artifacts/f61c63b3-3932-42ee-a87c-591a1c267de0 for reference this is what worked for me

Local Development Setup Guide

Prerequisites

  • Node.js installed
  • pnpm installed
  • A Vercel account

Initial Setup

  1. Clone the repository and install dependencies:

pnpm install 2. Set up your environment variables:

  • Create a .env file in the root directory
  • Generate an Auth.js secret:

npx auth secret

  • Add the secret to your .env:

AUTH_SECRET="your-generated-secret"

Database Setup

  1. Create a new project on Vercel and link it:

vercel link 2. Set up Postgres and Blob storage:

  • Go to your Vercel project dashboard
  • Navigate to the "Storage" tab
  • Create a new Postgres database
  • Add Blob storage
  1. Pull the environment variables:

vercel env pull This will add database-related environment variables to your .env file.

Database Migration

  1. Run the database migrations:

pnpm tsx lib/db/migrate.ts && pnpm run build If you encounter any errors about existing tables or foreign key constraints:

  1. Drop existing tables either through a database client or Prisma Studio
  2. Run the migrations again

Running the Application

Start the development server:

pnpm run dev The application should now be running at http://localhost:3000 (or 3001 if 3000 is in use).

Troubleshooting

Database Issues

If you encounter database-related errors:

  1. Ensure all environment variables are properly set in your .env file
  2. Check that the database tables are properly created
  3. If needed, drop all tables and rerun migrations

Authentication Issues

If you encounter authentication errors:

  1. Verify your AUTH_SECRET is properly set
  2. Ensure the database migrations have run successfully
  3. Check that your database connection is working

Known Issues

  • Port 3000 might be in use; the app will automatically try port 3001
  • Initial database setup might require dropping existing tables if migrations fail

Note About AI Models

This template uses Vercel's AI SDK which provides access to AI models without requiring individual API keys. The models are available through Vercel's infrastructure during development.

I ran the exact same but I can not fix the following error that occurs after trying to sign up or sign in:

[TypeError: Invalid URL] {
  code: 'ERR_INVALID_URL',
  input: '*',
  page: '/register'
}

My browser showing me this:

Error: An unexpected response was received from the server.
    at fetchServerAction (http://localhost:3000/_next/static/chunks/3dc60_next_dist_client_62519b05._.js:18106:37)
    at ClientPageRoot (http://localhost:3000/_next/static/chunks/3dc60_next_dist_7f1666fd._.js:2059:50)

I have tried multiple things so far but nothing seems to work 🙄

MarkusFox avatar Apr 11 '25 08:04 MarkusFox