You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Pretty much what the title states as of December 2024. You may want to update the README to help people set up the project with integration through Neon Database.
At https://vercel.com/marketplace/neon, you will need to click install where you will be able to select a Vercel team to install Neon Database. Select the region you want and options you want, then continue and name it whatever you want. Once created it'll give you all your .env.local secrets and can connect it with your project.
You will need to install @neondatabase/serverless in the project.
Then, the following db.ts file needs to be created somewhere, maybe the root of the project, or you can add it directly to the /lib/db/migrate.ts file.
// src/db.ts
import { drizzle } from "drizzle-orm/neon-http";
import { neon } from "@neondatabase/serverless";
import { config } from "dotenv";
config({ path: ".env.local" }); // or .env.local
const sql = neon(process.env.DATABASE_URL!);
export const db = drizzle(sql);
Then in /lib/db/migrate.ts, you need to import { db } from '@/db' (obviously don't need to do this if you put the above right in the file).
Next, change import { migrate } from 'drizzle-orm/postgres-js/migrator to import { migrate } from 'drizzle-orm/neon-http/migrator.
Hey are these all the steps? After taking these steps, i'm not able to login or signup from localhost, and it gives me the following error:
Failed to get user from database [auth][error] CallbackRouteError: Read more at https://errors.authjs.dev#callbackrouteerror [auth][cause]: PostgresError: relation "User" does not exist at ErrorResponse (/Users/essamsleiman/Desktop/DesktopFolder/Startup/canvas-org/canvas-copilot/.next/server/chunks/ssr/node_modules__pnpm_6e480e._.js:2529:224) at handle (/Users/essamsleiman/Desktop/DesktopFolder/Startup/canvas-org/canvas-copilot/.next/server/chunks/ssr/node_modules__pnpm_6e480e._.js:2329:728) at TLSSocket.data (/Users/essamsleiman/Desktop/DesktopFolder/Startup/canvas-org/canvas-copilot/.next/server/chunks/ssr/node_modules__pnpm_6e480e._.js:2217:17) at TLSSocket.emit (node:events:518:28) at addChunk (node:internal/streams/readable:559:12) at readableAddChunkPushByteMode (node:internal/streams/readable:510:3) at Readable.push (node:internal/streams/readable:390:5) at TLSWrap.onStreamRead (node:internal/stream_base_commons:190:23) at TLSWrap.callbackTrampoline (node:internal/async_hooks:130:17) [auth][details]: { "provider": "credentials"
Did you run db:generate and db:migrate scripts after putting in the neon database? db:generate will generate the sql scripts and db:migrate should move it into your db. Then you should be able to successfully create an account.
Pretty much what the title states as of December 2024. You may want to update the README to help people set up the project with integration through Neon Database.
At https://vercel.com/marketplace/neon, you will need to click install where you will be able to select a Vercel team to install Neon Database. Select the region you want and options you want, then continue and name it whatever you want. Once created it'll give you all your .env.local secrets and can connect it with your project.
You will need to install @neondatabase/serverless in the project.
Then, the following db.ts file needs to be created somewhere, maybe the root of the project, or you can add it directly to the /lib/db/migrate.ts file.
Then in /lib/db/migrate.ts, you need to
import { db } from '@/db'
(obviously don't need to do this if you put the above right in the file).Next, change
import { migrate } from 'drizzle-orm/postgres-js/migrator
toimport { migrate } from 'drizzle-orm/neon-http/migrator
.Finally, comment out or delete the lines
Definitely other ways to do it, this is just how I did it.
The text was updated successfully, but these errors were encountered: