I’m unable to get the site running and connect to the database. I keep getting this error whenever I do npm run dev
. I have even attempted to set connect_timeout
to 1
and pool_timeout
to 0
, pgbouncer
is also set to true
.
I’m using Next.js as the React Framework, Prisma as the ORM, and Vercel Postgre as the database.
.env
# Created by Vercel CLI
POSTGRES_DATABASE="verceldb"
POSTGRES_HOST="ep-shy-union-a2mpqijj-pooler.eu-central-1.aws.neon.tech:5432"
POSTGRES_PASSWORD="z8RAm4ZPkFwE"
POSTGRES_PRISMA_URL="postgres://default:z8RAm4ZPkFwE@ep-shy-union-a2mpqijj-pooler.eu-central-1.aws.neon.tech/verceldb?pgbouncer=true&connect_timeout=1&sslmode=require&pool_timeout=0"
POSTGRES_URL="postgres://default:z8RAm4ZPkFwE@ep-shy-union-a2mpqijj-pooler.eu-central-1.aws.neon.tech/verceldb?sslmode=require"
POSTGRES_URL_NON_POOLING="postgres://default:[email protected]/verceldb?sslmode=require"
POSTGRES_URL_NO_SSL="postgres://default:z8RAm4ZPkFwE@ep-shy-union-a2mpqijj-pooler.eu-central-1.aws.neon.tech/verceldb"
POSTGRES_USER="default"
GITHUB_ID='Ov23liZ0kDQosmNkm0M1'
GITHUB_SECRET='3c11c59da91c1dab9b725cce022d1368adb3f815'
NEXTAUTH_URL='http://localhost:3000/api/auth'
NEXTAUTH_SECRET='JFNrVuiOQZ3CgZmfjzl/wzKEFtXueSO+aA/VwSWIw8E='
package.json
{
"name": "hello-next",
"version": "1.0.0",
"description": "",
"scripts": {
"dev": "next",
"build": "next build",
"start": "next start"
},
"keywords": [],
"author": "",
"license": "MIT",
"dependencies": {
"@next-auth/prisma-adapter": "^1.0.7",
"@prisma/client": "^5.17.0",
"@vercel/postgres": "^0.9.0",
"next": "12.0.10",
"next-auth": "^4.24.7",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-markdown": "8.0.0"
},
"devDependencies": {
"@types/node": "17.9.1",
"@types/react": "17.0.38",
"prisma": "^5.17.0",
"typescript": "4.5.5"
}
}
index.tsx
import React from "react"
import { GetStaticProps } from "next"
import Layout from "../components/Layout"
import Post, { PostProps } from "../components/Post"
import prisma from '../lib/prisma';
export const getStaticProps: GetStaticProps = async () => {
const feed = await prisma.post.findMany({
where: { published: true },
include: {
author: {
select: { name: true },
},
},
});
return {
props: { feed },
revalidate: 10,
};
};
type Props = {
feed: PostProps[]
}
const Blog: React.FC<Props> = (props) => {
return <></>
}
export default Blog
2