Skip to content
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

Build failed with empty database #152

Open
CDN18 opened this issue Aug 1, 2023 · 3 comments
Open

Build failed with empty database #152

CDN18 opened this issue Aug 1, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@CDN18
Copy link

CDN18 commented Aug 1, 2023

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.
@CDN18 CDN18 added the bug Something isn't working label Aug 1, 2023
@MaxLeiter
Copy link
Owner

Thanks for the report, I need to update the instructions. In the meantime you can use pnpm prisma db push to generate and push the DB to your remote.

@CDN18
Copy link
Author

CDN18 commented Aug 2, 2023

Thanks for your help, my instance can build and run without problem now.

If you want to update the instructions part, perhaps the running with pm2 section also needs to be updated. I got the following error while executing pm2 start pnpm --name drift --interpreter bash -- start, but I can use pm2 run "pnpm start" --name drift without problem.

1|Drift   | /home/node/v18.16.0/bin/pnpm: line 2: `require('./lib/corepack.cjs').runMain(['pnpm', ...process.argv.slice(2)]);'
1|Drift   | /home/node/v18.16.0/bin/pnpm: line 2: syntax error near unexpected token `'./lib/corepack.cjs''

@CDN18
Copy link
Author

CDN18 commented Aug 2, 2023

Regarding build and setup, I also have a question about the GitHub OAuth configuration:

How should I set up the callback URL? I've currently set it as https://<my_drift_instance>, but I'm experiencing errors with registration and login.

Edit: It turns out that I set HTTP://<my_drift_instance> as NEXTAUTH_URL instead of HTTPS://<my_drift_instance>, which is the real url.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants