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.91k stars 2.04k forks source link

Unable to deploy using Vercel #135

Closed smallify-click closed 1 year ago

smallify-click commented 1 year ago

So I was not able to deploy directly, and after a bit of searching through the issues pages, saw that getTweet function is to be blamed , tried removing it and that lead to a million other issues, so I jusr added a new environment variable for Twitter_Bearer_Token. That fixed the intial issue but now there is some issue with the function that gets twitter media data below I have attached both the build logs.

Direct build from dub repo:

[20:58:13.438] Cloning github.com/abc/abc (Branch: main, Commit: f29850d)
[20:58:13.755] Previous build cache not available
[20:58:14.005] Cloning completed: 566.765ms
[20:58:14.878] Vercel CLI 28.6.0
[20:58:15.176] Installing dependencies...
[20:58:15.500] yarn install v1.22.17
[20:58:15.558] [1/4] Resolving packages...
[20:58:15.779] [2/4] Fetching packages...
[20:58:32.078] [3/4] Linking dependencies...
[20:58:32.084] warning " > focus-trap-react@10.0.1" has unmet peer dependency "prop-types@^15.8.1".
[20:58:32.084] warning "mailing-core > mjml-react > react-reconciler@0.26.2" has incorrect peer dependency "react@^17.0.2".
[20:58:32.085] warning "react-hot-toast > goober@2.1.11" has unmet peer dependency "csstype@^3.0.10".
[20:58:32.086] warning "react-spring > @react-spring/konva@9.5.5" has unmet peer dependency "konva@>=2.6".
[20:58:32.086] warning "react-spring > @react-spring/konva@9.5.5" has unmet peer dependency "react-konva@^16.8.0 || ^17.0.0".
[20:58:32.087] warning "react-spring > @react-spring/native@9.5.5" has unmet peer dependency "react-native@>=0.58".
[20:58:32.087] warning "react-spring > @react-spring/three@9.5.5" has unmet peer dependency "@react-three/fiber@>=6.0".
[20:58:32.087] warning "react-spring > @react-spring/three@9.5.5" has unmet peer dependency "three@>=0.126".
[20:58:32.087] warning "react-spring > @react-spring/zdog@9.5.5" has unmet peer dependency "react-zdog@>=1.0".
[20:58:32.088] warning "react-spring > @react-spring/zdog@9.5.5" has unmet peer dependency "zdog@>=1.0".
[20:58:32.088] warning " > @trivago/prettier-plugin-sort-imports@4.0.0" has unmet peer dependency "@vue/compiler-sfc@3.x".
[20:58:32.103] warning Workspaces can only be enabled in private projects.
[20:58:46.995] [4/4] Building fresh packages...
[20:58:50.987] $ prisma generate || true
[20:58:51.674] Prisma schema loaded from prisma/schema.prisma
[20:58:52.469] 
[20:58:52.469] ✔ Generated Prisma Client (4.6.1 | library) to ./node_modules/@prisma/client in 169ms
[20:58:52.471] You can now start using Prisma Client in your code. Reference: https://pris.ly/d/client
[20:58:52.471] ```
[20:58:52.472] import { PrismaClient } from '@prisma/client'
[20:58:52.472] const prisma = new PrismaClient()
[20:58:52.472] ```
[20:58:52.502] Done in 37.01s.
[20:58:52.537] Detected Next.js version: 13.0.5
[20:58:52.538] Running "yarn run build"
[20:58:52.784] yarn run v1.22.17
[20:58:52.811] $ prisma generate
[20:58:53.490] Prisma schema loaded from prisma/schema.prisma
[20:58:54.276] 
[20:58:54.276] ✔ Generated Prisma Client (4.6.1 | library) to ./node_modules/@prisma/client in 159ms
[20:58:54.277] You can now start using Prisma Client in your code. Reference: https://pris.ly/d/client
[20:58:54.277] ```
[20:58:54.277] import { PrismaClient } from '@prisma/client'
[20:58:54.277] const prisma = new PrismaClient()
[20:58:54.277] ```
[20:58:54.352] ┌─────────────────────────────────────────────────────────┐
[20:58:54.352] │  Update available 4.6.1 -> 4.7.1                        │
[20:58:54.352] │  Run the following to update                            │
[20:58:54.353] │    yarn add --dev prisma@latest                         │
[20:58:54.353] │    yarn add @prisma/client@latest                       │
[20:58:54.353] └─────────────────────────────────────────────────────────┘
[20:58:54.367] $ next build
[20:58:54.777] Attention: Next.js now collects completely anonymous telemetry regarding usage.
[20:58:54.777] This information is used to shape Next.js' roadmap and prioritize features.
[20:58:54.777] 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:
[20:58:54.777] https://nextjs.org/telemetry
[20:58:54.777] 
[20:58:54.898] info  - Linting and checking validity of types...
[20:59:02.345] info  - Creating an optimized production build...
[20:59:02.392] warn  - You are using an experimental edge runtime, the API might change.
[20:59:30.052] warn  - Compiled with warnings
[20:59:30.052] 
[20:59:30.052] ./node_modules/@upstash/redis/esm/platforms/nodejs.js
[20:59:30.052] A Node.js API is used (process.version at line: 26) which is not supported in the Edge Runtime.
[20:59:30.052] Learn more: https://nextjs.org/docs/api-reference/edge-runtime
[20:59:30.053] 
[20:59:30.053] Import trace for requested module:
[20:59:30.053] ./node_modules/@upstash/redis/esm/platforms/nodejs.js
[20:59:30.053] ./lib/upstash.ts
[20:59:30.053] 
[20:59:30.053] info  - Collecting page data...
[20:59:34.666] info  - Generating static pages (0/19)
[20:59:34.767] info  - Generating static pages (4/19)
[20:59:34.805] info  - Generating static pages (9/19)
[20:59:34.894] (node:1130) ExperimentalWarning: The Fetch API is an experimental feature. This feature could change at any time
[20:59:34.894] (Use `node --trace-warnings ...` to show where the warning was created)
[20:59:34.924] info  - Generating static pages (14/19)
[20:59:34.961] 
[20:59:34.962] Error occurred prerendering page "/metatags". Read more: https://nextjs.org/docs/messages/prerender-error
[20:59:34.962] TypeError: Cannot read properties of undefined (reading 'entities')
[20:59:34.962]     at getExternalUrls (/vercel/path0/.next/server/chunks/5298.js:491:36)
[20:59:34.962]     at getTweet (/vercel/path0/.next/server/chunks/5298.js:504:23)
[20:59:34.963]     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[20:59:34.963]     at async Promise.all (index 0)
[20:59:34.963]     at async getStaticProps (/vercel/path0/.next/server/pages/metatags.js:274:20)
[20:59:34.963]     at async renderToHTML (/vercel/path0/node_modules/next/dist/server/render.js:384:20)
[20:59:34.963]     at async /vercel/path0/node_modules/next/dist/export/worker.js:248:32
[20:59:34.964]     at async Span.traceAsyncFn (/vercel/path0/node_modules/next/dist/trace/trace.js:79:20)
[20:59:37.048] (node:1137) ExperimentalWarning: The Fetch API is an experimental feature. This feature could change at any time
[20:59:37.049] (Use `node --trace-warnings ...` to show where the warning was created)
[20:59:37.198] 
[20:59:37.201] Error occurred prerendering page "/". Read more: https://nextjs.org/docs/messages/prerender-error
[20:59:37.202] TypeError: Cannot read properties of undefined (reading 'entities')
[20:59:37.202]     at getExternalUrls (/vercel/path0/.next/server/chunks/5298.js:491:36)
[20:59:37.202]     at getTweet (/vercel/path0/.next/server/chunks/5298.js:504:23)
[20:59:37.202]     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[20:59:37.209]     at async Promise.all (index 5)
[20:59:37.209]     at async getStaticProps (/vercel/path0/.next/server/pages/index.js:1800:20)
[20:59:37.209]     at async renderToHTML (/vercel/path0/node_modules/next/dist/server/render.js:384:20)
[20:59:37.209]     at async /vercel/path0/node_modules/next/dist/export/worker.js:248:32
[20:59:37.209]     at async Span.traceAsyncFn (/vercel/path0/node_modules/next/dist/trace/trace.js:79:20)
[20:59:37.210] 
[20:59:37.210] > Build error occurred
[20:59:37.210] Error: Export encountered errors on following paths:
[20:59:37.210]  /
[20:59:37.211]  /metatags
[20:59:37.211]     at /vercel/path0/node_modules/next/dist/export/index.js:408:19
[20:59:37.211]     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[20:59:37.211]     at async Span.traceAsyncFn (/vercel/path0/node_modules/next/dist/trace/trace.js:79:20)
[20:59:37.211]     at async /vercel/path0/node_modules/next/dist/build/index.js:1334:21
[20:59:37.212]     at async Span.traceAsyncFn (/vercel/path0/node_modules/next/dist/trace/trace.js:79:20)
[20:59:37.212]     at async /vercel/path0/node_modules/next/dist/build/index.js:1194:17
[20:59:37.212]     at async Span.traceAsyncFn (/vercel/path0/node_modules/next/dist/trace/trace.js:79:20)
[20:59:37.212]     at async Object.build [as default] (/vercel/path0/node_modules/next/dist/build/index.js:65:29)
[20:59:37.212] info  - Generating static pages (19/19)
[20:59:37.263] error Command failed with exit code 1.
[20:59:37.263] info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
[20:59:37.286] Error: Command "yarn run build" exited with 1

After trying to fix the repo

[21:23:01.557] Cloning github.com/abc/abc (Branch: main, Commit: fa4a2eb)
[21:23:01.862] Previous build cache not available
[21:23:02.626] Cloning completed: 1.069s
[21:23:03.113] Running "vercel build"
[21:23:03.773] Vercel CLI 28.6.0
[21:23:05.058] Installing dependencies...
[21:23:05.489] yarn install v1.22.17
[21:23:05.584] [1/4] Resolving packages...
[21:23:06.033] [2/4] Fetching packages...
[21:23:38.087] [3/4] Linking dependencies...
[21:23:38.101] warning " > focus-trap-react@10.0.1" has unmet peer dependency "prop-types@^15.8.1".
[21:23:38.102] warning "mailing-core > mjml-react > react-reconciler@0.26.2" has incorrect peer dependency "react@^17.0.2".
[21:23:38.104] warning "react-hot-toast > goober@2.1.11" has unmet peer dependency "csstype@^3.0.10".
[21:23:38.105] warning "react-spring > @react-spring/konva@9.5.5" has unmet peer dependency "konva@>=2.6".
[21:23:38.105] warning "react-spring > @react-spring/konva@9.5.5" has unmet peer dependency "react-konva@^16.8.0 || ^17.0.0".
[21:23:38.106] warning "react-spring > @react-spring/native@9.5.5" has unmet peer dependency "react-native@>=0.58".
[21:23:38.106] warning "react-spring > @react-spring/three@9.5.5" has unmet peer dependency "@react-three/fiber@>=6.0".
[21:23:38.107] warning "react-spring > @react-spring/three@9.5.5" has unmet peer dependency "three@>=0.126".
[21:23:38.107] warning "react-spring > @react-spring/zdog@9.5.5" has unmet peer dependency "react-zdog@>=1.0".
[21:23:38.107] warning "react-spring > @react-spring/zdog@9.5.5" has unmet peer dependency "zdog@>=1.0".
[21:23:38.109] warning " > @trivago/prettier-plugin-sort-imports@4.0.0" has unmet peer dependency "@vue/compiler-sfc@3.x".
[21:23:38.138] warning Workspaces can only be enabled in private projects.
[21:23:55.016] [4/4] Building fresh packages...
[21:24:03.239] $ prisma generate || true
[21:24:05.535] Prisma schema loaded from prisma/schema.prisma
[21:24:07.070] 
[21:24:07.070] ✔ Generated Prisma Client (4.6.1 | library) to ./node_modules/@prisma/client in 255ms
[21:24:07.071] You can now start using Prisma Client in your code. Reference: https://pris.ly/d/client
[21:24:07.071] ```
[21:24:07.071] import { PrismaClient } from '@prisma/client'
[21:24:07.072] const prisma = new PrismaClient()
[21:24:07.072] ```
[21:24:07.108] Done in 61.63s.
[21:24:07.149] Detected Next.js version: 13.0.5
[21:24:07.152] Running "yarn run build"
[21:24:07.493] yarn run v1.22.17
[21:24:07.542] $ prisma generate
[21:24:09.831] Prisma schema loaded from prisma/schema.prisma
[21:24:11.323] 
[21:24:11.323] ✔ Generated Prisma Client (4.6.1 | library) to ./node_modules/@prisma/client in 247ms
[21:24:11.324] You can now start using Prisma Client in your code. Reference: https://pris.ly/d/client
[21:24:11.324] ```
[21:24:11.324] import { PrismaClient } from '@prisma/client'
[21:24:11.324] const prisma = new PrismaClient()
[21:24:11.324] ```
[21:24:11.427] ┌─────────────────────────────────────────────────────────┐
[21:24:11.428] │  Update available 4.6.1 -> 4.7.1                        │
[21:24:11.428] │  Run the following to update                            │
[21:24:11.428] │    yarn add --dev prisma@latest                         │
[21:24:11.429] │    yarn add @prisma/client@latest                       │
[21:24:11.429] └─────────────────────────────────────────────────────────┘
[21:24:11.451] $ next build
[21:24:12.028] Attention: Next.js now collects completely anonymous telemetry regarding usage.
[21:24:12.029] This information is used to shape Next.js' roadmap and prioritize features.
[21:24:12.029] 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:
[21:24:12.029] https://nextjs.org/telemetry
[21:24:12.030] 
[21:24:12.171] info  - Linting and checking validity of types...
[21:24:25.987] info  - Creating an optimized production build...
[21:24:26.060] warn  - You are using an experimental edge runtime, the API might change.
[21:25:13.220] warn  - Compiled with warnings
[21:25:13.220] 
[21:25:13.221] ./node_modules/@upstash/redis/esm/platforms/nodejs.js
[21:25:13.221] A Node.js API is used (process.version at line: 26) which is not supported in the Edge Runtime.
[21:25:13.221] Learn more: https://nextjs.org/docs/api-reference/edge-runtime
[21:25:13.221] 
[21:25:13.221] Import trace for requested module:
[21:25:13.222] ./node_modules/@upstash/redis/esm/platforms/nodejs.js
[21:25:13.222] ./lib/upstash.ts
[21:25:13.222] 
[21:25:13.222] info  - Collecting page data...
[21:25:20.757] info  - Generating static pages (0/19)
[21:25:20.926] info  - Generating static pages (4/19)
[21:25:20.966] info  - Generating static pages (9/19)
[21:25:20.976] TypeError: Cannot read properties of null (reading 'id')
[21:25:20.976]     at /vercel/path0/.next/server/pages/metatags.js:264:43
[21:25:20.977]     at Array.map (<anonymous>)
[21:25:20.977]     at Metatags (/vercel/path0/.next/server/pages/metatags.js:263:42)
[21:25:20.978]     at Wc (/vercel/path0/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:68:44)
[21:25:20.978]     at Zc (/vercel/path0/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:70:253)
[21:25:20.979]     at Z (/vercel/path0/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:89)
[21:25:20.979]     at $c (/vercel/path0/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:78:98)
[21:25:20.979]     at Zc (/vercel/path0/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:71:145)
[21:25:20.980]     at Z (/vercel/path0/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:89)
[21:25:20.980]     at $c (/vercel/path0/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:78:98)
[21:25:20.981] 
[21:25:20.982] Error occurred prerendering page "/metatags". Read more: https://nextjs.org/docs/messages/prerender-error
[21:25:20.982] TypeError: Cannot read properties of null (reading 'id')
[21:25:20.983]     at /vercel/path0/.next/server/pages/metatags.js:264:43
[21:25:20.983]     at Array.map (<anonymous>)
[21:25:20.983]     at Metatags (/vercel/path0/.next/server/pages/metatags.js:263:42)
[21:25:20.984]     at Wc (/vercel/path0/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:68:44)
[21:25:20.984]     at Zc (/vercel/path0/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:70:253)
[21:25:20.984]     at Z (/vercel/path0/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:89)
[21:25:20.985]     at $c (/vercel/path0/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:78:98)
[21:25:20.985]     at Zc (/vercel/path0/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:71:145)
[21:25:20.986]     at Z (/vercel/path0/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:89)
[21:25:20.986]     at $c (/vercel/path0/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:78:98)
[21:25:20.999] info  - Generating static pages (14/19)
[21:25:23.109] TypeError: Cannot read properties of null (reading 'id')
[21:25:23.109]     at /vercel/path0/.next/server/pages/index.js:1464:35
[21:25:23.109]     at Array.map (<anonymous>)
[21:25:23.110]     at Testimonials (/vercel/path0/.next/server/pages/index.js:1463:34)
[21:25:23.110]     at Wc (/vercel/path0/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:68:44)
[21:25:23.111]     at Zc (/vercel/path0/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:70:253)
[21:25:23.114]     at Z (/vercel/path0/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:89)
[21:25:23.114]     at $c (/vercel/path0/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:78:98)
[21:25:23.115]     at bd (/vercel/path0/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:77:404)
[21:25:23.115]     at Z (/vercel/path0/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:217)
[21:25:23.115]     at $c (/vercel/path0/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:78:98)
[21:25:23.115] 
[21:25:23.115] Error occurred prerendering page "/". Read more: https://nextjs.org/docs/messages/prerender-error
[21:25:23.115] TypeError: Cannot read properties of null (reading 'id')
[21:25:23.116]     at /vercel/path0/.next/server/pages/index.js:1464:35
[21:25:23.116]     at Array.map (<anonymous>)
[21:25:23.116]     at Testimonials (/vercel/path0/.next/server/pages/index.js:1463:34)
[21:25:23.116]     at Wc (/vercel/path0/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:68:44)
[21:25:23.116]     at Zc (/vercel/path0/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:70:253)
[21:25:23.116]     at Z (/vercel/path0/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:89)
[21:25:23.116]     at $c (/vercel/path0/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:78:98)
[21:25:23.117]     at bd (/vercel/path0/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:77:404)
[21:25:23.117]     at Z (/vercel/path0/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:217)
[21:25:23.117]     at $c (/vercel/path0/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:78:98)
[21:25:23.117] 
[21:25:23.117] > Build error occurred
[21:25:23.117] info  - Generating static pages (19/19)
[21:25:23.120] Error: Export encountered errors on following paths:
[21:25:23.120]  /
[21:25:23.121]  /metatags
[21:25:23.121]     at /vercel/path0/node_modules/next/dist/export/index.js:408:19
[21:25:23.121]     at runMicrotasks (<anonymous>)
[21:25:23.122]     at processTicksAndRejections (node:internal/process/task_queues:96:5)
[21:25:23.122]     at async Span.traceAsyncFn (/vercel/path0/node_modules/next/dist/trace/trace.js:79:20)
[21:25:23.122]     at async /vercel/path0/node_modules/next/dist/build/index.js:1334:21
[21:25:23.123]     at async Span.traceAsyncFn (/vercel/path0/node_modules/next/dist/trace/trace.js:79:20)
[21:25:23.123]     at async /vercel/path0/node_modules/next/dist/build/index.js:1194:17
[21:25:23.123]     at async Span.traceAsyncFn (/vercel/path0/node_modules/next/dist/trace/trace.js:79:20)
[21:25:23.124]     at async Object.build [as default] (/vercel/path0/node_modules/next/dist/build/index.js:65:29)
[21:25:23.188] error Command failed with exit code 1.
[21:25:23.189] info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
[21:25:23.210] Error: Command "yarn run build" exited with 1
softhedev commented 1 year ago

Same issue here. Were you able to find a solution for it?

steven-tey commented 1 year ago

If you're self-hosting Dub, feel free to get rid of all instances of the static tweets implementation (on the root page / and /metatags). Those are not required for the app itself, I'm just using them for the marketing pages 😄

tomy0000000 commented 1 year ago

@steven-tey could you elaborate more details on which part of the source codes should be removed? Cause I don't think it will work, just simply remove those 2 .tsx files.

tomy0000000 commented 1 year ago

Take some time to dig into this problem today, and find the easiest solution is to pass in an empty array to the getTweetsMetadata function.

For anyone interested, find my patch at https://github.com/tomy0000000/dub/commit/e29f77217cdcd91f3a069e1779f9d1ad81c4740c.

steven-tey commented 1 year ago

Apologies for the delayed response here! I just pushed up a commit today that would make the repo work even if you don't have any env vars specified (you just wont see the static tweets). Closing this now, sorry for the trouble before y'all!