-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to seed the DB #868
Comments
Same issue here, been trying this since yesterday. I commented everything out in the route.ts file except the import statements and the |
Do this
|
Yes, maybe if you read my comment completely you would see that futher down the road you still keep on having issues connecting to the database. |
Oh sorry, didn't read it fully. I just copy pasted my answer from another issue. If you fix it, please tag me @arytix Maybe keep on making changes and keep on pushing to github LOL |
I got it working. I deleted everything and rebuilt from scratch. This time, I chose a server location for the database closer to my physical location instead of the default in Washington. Now, everything works perfectly. It seems there was a latency or distance restriction for a local connection to the DB. |
paste this in route.ts Domain URL go for the seed path /seed import bcrypt from 'bcrypt'; const client = await db.connect(); async function seedUsers() { const insertedUsers = await Promise.all( return insertedUsers; async function seedInvoices() { await client.sql const insertedInvoices = await Promise.all( return insertedInvoices; async function seedCustomers() { await client.sql const insertedCustomers = await Promise.all( return insertedCustomers; async function seedRevenue() { const insertedRevenue = await Promise.all( return insertedRevenue; export async function GET() { try {
} catch (error) { |
After uncommenting the route.ts file remove this
from line 105 to 108 |
Hello guys, the solution is as simple as deleting from line 105 to 108 |
The issue as far as I can tell is that the Washington default server causes a latency that lags out the request. If you are using the "@vercel/postgres" package to connect to their cloud database, it might work better if you delete the database, re-create the database, and select a server close to your geographic location. One of the ways I confirmed this was the issue:
Without looking into the specific code that is a part of the Vercel postgres package, I am going to assume that the request is timing out (read: unresolved promise) due to geographic location. This issue should be fixed if someone from Vercel ever has 20 minutes to fix this. |
Been following this tutorial: https://nextjs.org/learn/dashboard-app/setting-up-your-database
When I'm trying to see the DB, it says:
![image](https://private-user-images.githubusercontent.com/49852384/368897280-aab7edb1-51e2-47c3-81d5-be8439ca89a4.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk1NDk1MTEsIm5iZiI6MTczOTU0OTIxMSwicGF0aCI6Ii80OTg1MjM4NC8zNjg4OTcyODAtYWFiN2VkYjEtNTFlMi00N2MzLTgxZDUtYmU4NDM5Y2E4OWE0LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTQlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjE0VDE2MDY1MVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTlhN2MzOTFiNmYwYzU2YzBiZDM5MDI2ZTA4OTRjY2NhMTBhNDkxNzFiZjE0ZDM4NjhlZWMwMGRmYzk0YWIyZTMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.4HJ00S1iXXz2PRXF3-N0fGIuNC6huW0YOL-k9cj2dfM)
I don't know what to do. I have tried everything.
My route.ts in my seed folder looks like:
My .env is also pretty good. it's set.
The text was updated successfully, but these errors were encountered: