vercel / ai-chatbot

A full-featured, hackable Next.js AI chatbot built by Vercel
https://chat.vercel.ai
Other
9.43k stars 2.39k forks source link

Failed to create account when deploying from vercel button #544

Open SarbastJundi opened 1 day ago

SarbastJundi commented 1 day ago

/register

Failed to get user from database

angelhodar commented 1 day ago

It seems that the path for db migrations is wrong, you need to change this in the migrate.ts file:

await migrate(db, { migrationsFolder: './lib/drizzle' });

To this:

await migrate(db, { migrationsFolder: './lib/db/migrations' });

Before running the app, make sure you execute the db:migrate command from package.json to prepare the DB tables.

In my case after that I still had the error, so I logged it and got this:

Failed to get user from database
[Error: Client network socket disconnected before secure TLS connection was established] {
  code: 'ECONNRESET',
  path: undefined,
  host: undefined,
  port: undefined,
  localAddress: undefined
}

I am self hosting the chatbot app with a postgres db, and to fix it I removed the ssl=require option from the queries.ts file and now its working. That option should not be there as it should go in the POSTGRES_URL env var if needed.

lparcus commented 1 day ago

i had the same problem and this solution didnt work. And the thing is that the app should work as it's offered by vercel. How's it possible that they make you create an app saying it's easy and it comes with a fatal bug that prevents any user from using it ?

mrcodiator commented 21 hours ago

Hey Here are some tps:

If you have configured the git repo follow the commands:

- npm i -g pnpm
- pnpm i
- pnpm drizzle-kit generate
- pnpm drizzle-kit migrate
- pnpm drizzle-kit push

Note: You don't need to change anything in migration file. After running all this commands it will automatically create migrations for you.

Setup:

As I told you I have configured and created the pull request. So it works for me.