vercel / ai-chatbot

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

Fix: Handle registration error during initial deployment due to missing 'users' table #269

Closed JazzuLu closed 4 months ago

JazzuLu commented 4 months ago

Link issue: https://github.com/vercel/ai-chatbot/issues/262

Problem Description:

During the initial deployment, attempting to register as a user results in an error. This is because the necessary 'users' table is missing from the PostgreSQL database.

Solution:

I have added a check to verify the existence of the 'users' table. If the table does not exist, I create the 'users' table to resolve this issue.

Details of the Changes:

Added a function checkIfUsersTableExists() to check if the 'users' table exists. If the 'users' table does not exist, it is created.

Testing Results:

I have tested this modification in my local environment to ensure that the registration functionality works correctly during the initial deployment.

vercel[bot] commented 4 months ago

@JazzuLu is attempting to deploy a commit to the Uncurated Tests Team on Vercel.

A member of the Team first needs to authorize it.

AarushSah commented 4 months ago

Had the same issue and this PR fixed it. +1

jeremyphilemon commented 4 months ago

@JazzuLu We updated the implementation to have the kv datastore handle auth data as well, so there's no need for setting up another postgres database! Thanks for the pull request anyway :)

rogerodipo commented 4 months ago

@jeremyphilemon I have tried this today on a brand new deployment, but still can't get user authentication to work. Getting the error "Something went wrong, please try again." Running on Vercel. https://haki-seven.vercel.app.

jeremyphilemon commented 4 months ago

@rogerodipo can you confirm