MaxLeiter / MaxLeiter/Drift

Build failed with empty database

Open
#152 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
1.4k
Forks
58
PR merge metrics
No merged PRs in 30d

Description

Describe the bug
I'm trying to perform a fresh install on the refactor branch. However pnpm build results in an error saying that The table public.posts does not exist in the current database.

To Reproduce
Steps to reproduce the behavior:

  1. checkout the refactor branch, initialize an empty database, fill in .env and install dependencies
  2. pnpm build
  3. See error

Expected behavior
The build exits successfully.

Stacktrace

PrismaClientKnownRequestError: 
Invalid `prisma.post.findMany()` invocation:


The table `public.posts` does not exist in the current database.
    at zr.handleRequestError (/var/www/drift/node_modules/.pnpm/@prisma+client@5.0.0_prisma@5.0.0/node_modules/@prisma/client/runtime/library.js:122:8308)
    at zr.handleAndLogRequestError (/var/www/drift/node_modules/.pnpm/@prisma+client@5.0.0_prisma@5.0.0/node_modules/@prisma/client/runtime/library.js:122:7697)
    at zr.request (/var/www/drift/node_modules/.pnpm/@prisma+client@5.0.0_prisma@5.0.0/node_modules/@prisma/client/runtime/library.js:122:7307)
    at async getAllPosts (/var/www/drift/.next/server/chunks/1364.js:174:19)
    at async Object.generateStaticParams (/var/www/drift/.next/server/app/pages/[fileId]/[fileTitle]/page.js:482:19)
    at async buildParams (/var/www/drift/node_modules/.pnpm/next@13.4.11-canary.1_@babel+core@7.21.0_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/build/utils.js:917:36)
    at async /var/www/drift/node_modules/.pnpm/next@13.4.11-canary.1_@babel+core@7.21.0_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/build/utils.js:934:33
    at async /var/www/drift/node_modules/.pnpm/next@13.4.11-canary.1_@babel+core@7.21.0_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/build/utils.js:1067:117
    at async Span.traceAsyncFn (/var/www/drift/node_modules/.pnpm/next@13.4.11-canary.1_@babel+core@7.21.0_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/trace/trace.js:103:20) {
  code: 'P2021',
  clientVersion: '5.0.0',
  meta: { table: 'public.posts' }
}

> Build error occurred
Error: Failed to collect page data for /pages/[fileId]/[fileTitle]
    at /var/www/drift/node_modules/.pnpm/next@13.4.11-canary.1_@babel+core@7.21.0_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/build/utils.js:1156:15 {
  type: 'Error'
}
- info Collecting page data . ELIFECYCLE  Command failed with exit code 1.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure on the refactor branch with an empty database using the listed .env setup and pnpm build. Then inspect getAllPosts and generateStaticParams for /pages/[fileId]/[fileTitle], as named in the stack trace. Done means pnpm build exits successfully without the missing public.posts error.

Written by the indexing model from the issue text.

Assessment

Tech stack
nextjs, typescript
Domain
build-system, database
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.