dubinc / dub

Open-source link management infrastructure. Loved by modern marketing teams like Vercel, Raycast, and Perplexity.
https://dub.co
GNU Affero General Public License v3.0
18.52k stars 2k forks source link

Error during Vercel setup of Dub #104

Closed dillfrescott closed 1 year ago

dillfrescott commented 1 year ago
[02:38:17.390] Cloning github.com/dillfrescott/dub (Branch: main, Commit: 9f2b61a)
[02:38:17.696] Previous build cache not available
[02:38:18.033] Cloning completed: 643.037ms
[02:38:18.650] Not using Build Cache
[02:38:18.704] Running "vercel build"
[02:38:19.359] Vercel CLI 28.4.14
[02:38:19.815] Installing dependencies...
[02:38:20.249] yarn install v1.22.17
[02:38:20.349] [1/4] Resolving packages...
[02:38:20.805] [2/4] Fetching packages...
[02:39:00.414] warning swr@2.0.0-beta.6: The engine "pnpm" appears to be invalid.
[02:39:00.420] [3/4] Linking dependencies...
[02:39:00.442] warning " > focus-trap-react@10.0.0" has unmet peer dependency "prop-types@^15.8.1".
[02:39:00.445] warning "mailing > mjml-react > react-reconciler@0.26.2" has incorrect peer dependency "react@^17.0.2".
[02:39:00.448] warning "react-hot-toast > goober@2.1.11" has unmet peer dependency "csstype@^3.0.10".
[02:39:00.449] warning "react-spring > @react-spring/konva@9.5.4" has unmet peer dependency "konva@>=2.6".
[02:39:00.449] warning "react-spring > @react-spring/konva@9.5.4" has unmet peer dependency "react-konva@^16.8.0 || ^17.0.0".
[02:39:00.450] warning "react-spring > @react-spring/native@9.5.4" has unmet peer dependency "react-native@>=0.58".
[02:39:00.450] warning "react-spring > @react-spring/three@9.5.4" has unmet peer dependency "@react-three/fiber@>=6.0".
[02:39:00.451] warning "react-spring > @react-spring/three@9.5.4" has unmet peer dependency "three@>=0.126".
[02:39:00.452] warning "react-spring > @react-spring/zdog@9.5.4" has unmet peer dependency "react-zdog@>=1.0".
[02:39:00.452] warning "react-spring > @react-spring/zdog@9.5.4" has unmet peer dependency "zdog@>=1.0".
[02:39:00.479] warning Workspaces can only be enabled in private projects.
[02:39:13.571] [4/4] Building fresh packages...
[02:39:23.852] $ prisma generate || true
[02:39:26.293] Prisma schema loaded from prisma/schema.prisma
[02:39:27.806] 
[02:39:27.807] ✔ Generated Prisma Client (4.3.1 | library) to ./node_modules/@prisma/client in 240ms
[02:39:27.807] You can now start using Prisma Client in your code. Reference: https://pris.ly/d/client
[02:39:27.807] ```
[02:39:27.807] import { PrismaClient } from '@prisma/client'
[02:39:27.807] const prisma = new PrismaClient()
[02:39:27.807] ```
[02:39:27.903] Done in 67.66s.
[02:39:27.942] Detected Next.js version: 12.3.1
[02:39:27.944] Running "yarn run build"
[02:39:28.295] yarn run v1.22.17
[02:39:28.344] $ prisma generate
[02:39:30.736] Prisma schema loaded from prisma/schema.prisma
[02:39:32.228] 
[02:39:32.228] ✔ Generated Prisma Client (4.3.1 | library) to ./node_modules/@prisma/client in 238ms
[02:39:32.228] You can now start using Prisma Client in your code. Reference: https://pris.ly/d/client
[02:39:32.228] ```
[02:39:32.229] import { PrismaClient } from '@prisma/client'
[02:39:32.229] const prisma = new PrismaClient()
[02:39:32.229] ```
[02:39:32.395] ┌─────────────────────────────────────────────────────────┐
[02:39:32.396] │  Update available 4.3.1 -> 4.5.0                        │
[02:39:32.396] │  Run the following to update                            │
[02:39:32.396] │    yarn add --dev prisma@latest                         │
[02:39:32.396] │    yarn add @prisma/client@latest                       │
[02:39:32.396] └─────────────────────────────────────────────────────────┘
[02:39:32.414] $ next build
[02:39:32.778] info  - Loaded env from /vercel/path0/.env.production
[02:39:32.966] Attention: Next.js now collects completely anonymous telemetry regarding usage.
[02:39:32.967] This information is used to shape Next.js' roadmap and prioritize features.
[02:39:32.967] You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
[02:39:32.967] https://nextjs.org/telemetry
[02:39:32.967] 
[02:39:33.106] info  - Linting and checking validity of types...
[02:39:47.011] info  - Creating an optimized production build...
[02:39:47.065] warn  - You are using an experimental edge runtime, the API might change.
[02:40:27.885] info  - Compiled successfully
[02:40:27.885] info  - Collecting page data...
[02:40:32.623] info  - Generating static pages (0/17)
[02:40:32.729] info  - Generating static pages (4/17)
[02:40:32.769] info  - Generating static pages (8/17)
[02:40:32.807] info  - Generating static pages (12/17)
[02:40:32.891] 
[02:40:32.892] Error occurred prerendering page "/". Read more: https://nextjs.org/docs/messages/prerender-error
[02:40:32.892] Error: 
[02:40:32.892] Invalid `prisma.user.count()` invocation:
[02:40:32.892] 
[02:40:32.893] 
[02:40:32.893] The table `(not available)` does not exist in the current database.
[02:40:32.893]     at RequestHandler.handleRequestError (/vercel/path0/node_modules/@prisma/client/runtime/index.js:29909:13)
[02:40:32.893]     at RequestHandler.request (/vercel/path0/node_modules/@prisma/client/runtime/index.js:29892:12)
[02:40:32.893]     at async PrismaClient._request (/vercel/path0/node_modules/@prisma/client/runtime/index.js:30864:16)
[02:40:32.893]     at async getStaticProps (/vercel/path0/.next/server/pages/index.js:2287:23)
[02:40:32.894]     at async renderToHTML (/vercel/path0/node_modules/next/dist/server/render.js:386:20)
[02:40:32.894]     at async /vercel/path0/node_modules/next/dist/export/worker.js:304:36
[02:40:32.894]     at async Span.traceAsyncFn (/vercel/path0/node_modules/next/dist/trace/trace.js:79:20)
[02:40:32.894] info  - Generating static pages (17/17)
[02:40:32.895] 
[02:40:32.895] > Build error occurred
[02:40:32.898] Error: Export encountered errors on following paths:
[02:40:32.898]  /
[02:40:32.899]     at /vercel/path0/node_modules/next/dist/export/index.js:404:19
[02:40:32.899]     at runMicrotasks (<anonymous>)
[02:40:32.899]     at processTicksAndRejections (node:internal/process/task_queues:96:5)
[02:40:32.900]     at async Span.traceAsyncFn (/vercel/path0/node_modules/next/dist/trace/trace.js:79:20)
[02:40:32.900]     at async /vercel/path0/node_modules/next/dist/build/index.js:1229:21
[02:40:32.900]     at async Span.traceAsyncFn (/vercel/path0/node_modules/next/dist/trace/trace.js:79:20)
[02:40:32.900]     at async /vercel/path0/node_modules/next/dist/build/index.js:1091:17
[02:40:32.901]     at async Span.traceAsyncFn (/vercel/path0/node_modules/next/dist/trace/trace.js:79:20)
[02:40:32.901]     at async Object.build [as default] (/vercel/path0/node_modules/next/dist/build/index.js:65:29)
[02:40:32.960] error Command failed with exit code 1.
[02:40:32.960] info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
[02:40:32.985] Error: Command "yarn run build" exited with 1
steven-tey commented 1 year ago

This is probably because the user table is not instantiated in the MySQL database. I still need to write up the guide for this but in the meantime you can follow what I wrote here for a similar project on how to set up Prisma + Planetscale: https://vercel.com/guides/nextjs-multi-tenant-application

dillfrescott commented 1 year ago

Gotcha. Thank you! I will see what I can do!

dillfrescott commented 1 year ago

I'm really confused on how to do this. Can't I create the missing table?

tomy0000000 commented 1 year ago

Setup the DATABASE_URL env on local and runs npx prisma db push to push schema to planetscale.

Found this by reading this tutorial.

steven-tey commented 1 year ago

Closing this for now – we've updated the self-hosting guide (re: #12) so feel free to try it again and let me know if it still doesn't work!