Open smartdriver321 opened 4 months ago
i also get the similar error PS C:\Users\User\dash-admin> npx drizzle-kit push drizzle-kit: v0.23.0 drizzle-orm: v0.32.0
No config path provided, using default path
Reading config file 'C:\Users\User\dash-admin\drizzle.config.ts'
Using '@vercel/postgres' driver for database querying
Warning '@vercel/postgres' can only connect to remote Neon/Vercel Postgres/Supabase instances through a websocket
[✓] Pulling schema from database...
error: function uuid_generate_v4() does not exist
at C:\Users\User\dash-admin\node_modules.pnpm\drizzle-kit@0.23.0\node_modules\drizzle-kit\bin.cjs:87414:23
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Object.query (C:\Users\User\dash-admin\node_modules.pnpm\drizzle-kit@0.23.0\node_modules\drizzle-kit\bin.cjs:121475:26)
at async pgPush (C:\Users\User\dash-admin\node_modules.pnpm\drizzle-kit@0.23.0\node_modules\drizzle-kit\bin.cjs:124361:13)
at async _Command.
and on next command again
PS C:\Users\User\dash-admin> npx tsx ./db/seed.ts
Need to install the following packages:
tsx@4.16.2
Ok to proceed? (y) y
error: relation "revenue" does not exist
at C:\Users\User\dash-admin\node_modules.pnpm\@neondatabase+serverless@0.9.4\node_modules\@neondatabase\serverless\index.js:1345:74
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at
Error: Failed to seed database at main (C:\Users\User\dash-admin\db\seed.ts:25:11) at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Node.js v21.5.0
check it out.
@smartdriver321 the error is self-explanatory. do you have .env.local in the root folder of the project which contains POSTGRES_URL? I updated the README.md here: https://github.com/basir/next-15-admin-dashboard?tab=readme-ov-file#run-locally
@cryptodude-go The error "error: function uuid_generate_v4() does not exist" typically occurs when you're trying to use the uuid_generate_v4() function in a database system that doesn't have it built-in by default. Here's how to fix it:
PostgreSQL: The uuid_generate_v4() function is available in PostgreSQL by default. No additional setup is needed.
Other Databases: If you're using a different database system, it might not have a built-in uuid_generate_v4() function. You'll need to check your database's documentation for alternative methods of generating UUIDs. Some databases might offer similar functionality with different function names.
If you're using PostgreSQL and the function isn't working even though it should be available, there might be a schema search path issue. You can try enabling the uuid-ossp extension explicitly: SQL CREATE EXTENSION IF NOT EXISTS "uuid-ossp"; Use code with caution.
If your database doesn't support uuid_generate_v4() or enabling the extension isn't an option, you can explore alternative methods for generating UUIDs:
Client-side generation: You can generate UUIDs in your application code before sending them to the database. There are libraries available for most programming languages that can handle UUID generation. Database-specific functions: Some databases offer alternative functions for generating unique identifiers. Consult your database documentation for available options. Additional Tips:
Double-check the spelling of the function name (uuid_generate_v4()). Typos can lead to this error. If you're using an ORM or a framework, refer to its documentation for specific instructions on using UUIDs. They might have built-in functionalities for handling UUID generation.
@smartdriver321 the error is self-explanatory. do you have .env.local in the root folder of the project which contains POSTGRES_URL? I updated the README.md here: https://github.com/basir/next-15-admin-dashboard?tab=readme-ov-file#run-locally
It is weird my app couldn't read variables in env.local but when I renamed env.local to just .env instead. It worked. I got access to drizzle studio. Now I can finish the whole tutorial. Thanks for the support. Your repo deserved 5 stars
sounds good. make sure you import env-config.ts in this file: https://github.com/basir/next-15-admin-dashboard/blob/main/drizzle.config.ts wihtout it, drizzle studio can't read .env.local
found my mistake. gj also you should do similar dashboard with mongodb. Great job on this tutorial although
found my mistake. gj also you should do similar dashboard with mongodb. Great job on this tutorial although
sure, will do.
npx tsx ./db/seed.ts VercelPostgresError: VercelPostgresError - 'missing_connection_string': You did not supply a 'connectionString' and no 'POSTGRES_URL' env var was found. at createPool (C:\Users\user\Documents\dashboard-apps\dash-admin15\node_modules.pnpm\@vercel+postgres@0.9.0\node_modules\@vercel\postgres\src\create-pool.ts:86:11) at Object.get (C:\Users\user\Documents\dashboard-apps\dash-admin15\node_modules.pnpm\@vercel+postgres@0.9.0\node_modules\@vercel\postgres\src\index.ts:23:16) at VercelPgPreparedQuery.execute (C:\Users\user\Documents\dashboard-apps\dash-admin15\nodemodules.pnpm\drizzle-orm@0.32.0@neondatabase+serverless@0.9.4@types+pg@8.11.6@types+react@18.3.3_@verce_r3smpz6pan4xhwuh675nfk5pbe\node_modules\src\vercel-postgres\session.ts:57:18) at QueryPromise.execute (C:\Users\user\Documents\dashboard-apps\dash-admin15\nodemodules.pnpm\drizzle-orm@0.32.0@neondatabase+serverless@0.9.4@types+pg@8.11.6@types+react@18.3.3_@verce_r3smpz6pan4xhwuh675nfk5pbe\node_modules\src\pg-core\db.ts:604:19) at QueryPromise.then (C:\Users\user\Documents\dashboard-apps\dash-admin15\nodemodules.pnpm\drizzle-orm@0.32.0@neondatabase+serverless@0.9.4@types+pg@8.11.6@types+react@18.3.3_@verce_r3smpz6pan4xhwuh675nfk5pbe\node_modules\src\query-promise.ts:31:15) { code: 'missing_connection_string'
} C:\Users\user\Documents\dashboard-apps\dash-admin15\db\seed.ts:24 throw new Error('Failed to seed database') ^
Error: Failed to seed database
at main (C:\Users\user\Documents\dashboard-apps\dash-admin15\db\seed.ts:24:9)
Node.js v21.5.0