journey-ad / Bitmagnet-Next-Web

🧲 A modern BitTorrent indexer, powered by Bitmagnet. / 一个更现代的磁力搜索列表程序,由 Bitmagnet 强力驱动。
https://bitmagnet-next-web.vercel.app
MIT License
125 stars 18 forks source link

请问会支持vercel部署吗?刚部署试了下无法使用🤣 #2

Open wensley opened 1 month ago

wensley commented 1 month ago

已经配置链接数据库了,以下是vercel部署日志

[20:19:57.385] Skipping build cache, deployment was triggered without cache.
[20:19:57.702] Cloning completed: 331.688ms
[20:19:57.984] Running "vercel build"
[20:19:58.425] Vercel CLI 34.3.0
[20:19:58.836] Installing dependencies...
[20:21:13.846] npm WARN deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
[20:21:14.405] npm WARN deprecated rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported
[20:21:14.574] npm WARN deprecated @humanwhocodes/object-schema@2.0.3: Use @eslint/object-schema instead
[20:21:15.829] npm WARN deprecated @humanwhocodes/config-array@0.11.14: Use @eslint/config-array instead
[20:21:15.946] npm WARN deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
[20:21:25.032] 
[20:21:25.033] added 820 packages in 1m
[20:21:25.033] 
[20:21:25.034] 167 packages are looking for funding
[20:21:25.034]   run `npm fund` for details
[20:21:25.101] Detected Next.js version: 14.2.3
[20:21:25.103] Running "npm run build"
[20:21:25.368] 
[20:21:25.369] > build
[20:21:25.369] > cross-env BUILD_MODE=standalone next build
[20:21:25.370] 
[20:21:26.014] [Next] build mode: standalone
[20:21:26.035] Attention: Next.js now collects completely anonymous telemetry regarding usage.
[20:21:26.035] This information is used to shape Next.js' roadmap and prioritize features.
[20:21:26.036] 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:21:26.036] https://nextjs.org/telemetry
[20:21:26.036] 
[20:21:26.099]   ▲ Next.js 14.2.3
[20:21:26.100] 
[20:21:26.170]    Creating an optimized production build ...
[20:22:11.022]  ✓ Compiled successfully
[20:22:11.023]    Linting and checking validity of types ...
[20:22:14.699] 
[20:22:14.700]  ⚠ The Next.js plugin was not detected in your ESLint configuration. See https://nextjs.org/docs/basic-features/eslint#migrating-existing-config
[20:22:18.737] 
[20:22:18.737] ./app/api/detail/route.ts
[20:22:18.737] 68:5  Warning: Unexpected console statement.  no-console
[20:22:18.738] 
[20:22:18.738] ./app/api/graphql/route.ts
[20:22:18.738] 14:3  Warning: Unexpected console statement.  no-console
[20:22:18.738] 
[20:22:18.738] ./app/api/graphql/service.ts
[20:22:18.738] 164:5  Warning: Unexpected console statement.  no-console
[20:22:18.738] 165:5  Warning: Unexpected console statement.  no-console
[20:22:18.738] 282:5  Warning: Unexpected console statement.  no-console
[20:22:18.738] 283:5  Warning: Unexpected console statement.  no-console
[20:22:18.738] 323:5  Warning: Unexpected console statement.  no-console
[20:22:18.738] 362:5  Warning: Unexpected console statement.  no-console
[20:22:18.738] 421:5  Warning: Unexpected console statement.  no-console
[20:22:18.738] 
[20:22:18.738] ./app/api/preview/[hash64]/[id]/route.ts
[20:22:18.738] 29:5  Warning: Unexpected console statement.  no-console
[20:22:18.738] 30:5  Warning: Unexpected console statement.  no-console
[20:22:18.738] 31:5  Warning: Unexpected console statement.  no-console
[20:22:18.738] 32:5  Warning: Unexpected console statement.  no-console
[20:22:18.738] 41:5  Warning: Unexpected console statement.  no-console
[20:22:18.738] 
[20:22:18.738] ./app/api/preview/[hash64]/route.ts
[20:22:18.738] 3:1  Warning: There should be at least one empty line between import groups  import/order
[20:22:18.738] 3:10  Warning: 'base64ToHex' is defined but never used.  unused-imports/no-unused-imports
[20:22:18.738] 3:10  Warning: 'base64ToHex' is defined but never used.  @typescript-eslint/no-unused-vars
[20:22:18.738] 3:23  Warning: 'getLinkInfoFromWhatsLink' is defined but never used.  unused-imports/no-unused-imports
[20:22:18.738] 3:23  Warning: 'getLinkInfoFromWhatsLink' is defined but never used.  @typescript-eslint/no-unused-vars
[20:22:18.738] 4:1  Warning: `../service` import should occur before import of `@/utils`  import/order
[20:22:18.738] 6:7  Warning: 'invalid' is assigned a value but never used.  @typescript-eslint/no-unused-vars
[20:22:18.738] 26:5  Warning: Unexpected console statement.  no-console
[20:22:18.738] 38:5  Warning: Unexpected console statement.  no-console
[20:22:18.738] 
[20:22:18.738] ./app/api/preview/service.ts
[20:22:18.738] 3:55  Warning: Replace `'@/utils'` with `"@/utils"`  prettier/prettier
[20:22:18.738] 40:5  Warning: Unexpected console statement.  no-console
[20:22:18.738] 50:5  Warning: Unexpected console statement.  no-console
[20:22:18.738] 
[20:22:18.738] ./app/api/search/route.ts
[20:22:18.738] 75:5  Warning: Unexpected console statement.  no-console
[20:22:18.739] 116:5  Warning: Unexpected console statement.  no-console
[20:22:18.739] 
[20:22:18.739] ./app/api/stats/route.ts
[20:22:18.739] 48:5  Warning: Unexpected console statement.  no-console
[20:22:18.739] 
[20:22:18.739] ./app/detail/[hash64]/page.tsx
[20:22:18.739] 13:5  Warning: Unexpected console statement.  no-console
[20:22:18.739] 
[20:22:18.739] ./app/search/page.tsx
[20:22:18.739] 89:5  Warning: Unexpected console statement.  no-console
[20:22:18.739] 
[20:22:18.739] info  - Need to disable some ESLint rules? Learn more here: https://nextjs.org/docs/basic-features/eslint#disabling-rules
[20:22:22.266]    Collecting page data ...
[20:22:25.253]    Generating static pages (0/11) ...
[20:22:26.212]    Generating static pages (2/11) 
[20:22:26.236]    Generating static pages (5/11) 
[20:22:26.338]    Generating static pages (8/11) 
[20:22:26.441]  ✓ Generating static pages (11/11)
[20:22:27.056]    Finalizing page optimization ...
[20:22:27.057]    Collecting build traces ...
[20:22:40.167] 
[20:22:40.170] Route (app)                              Size     First Load JS
[20:22:40.171] ┌ ƒ /                                    4.25 kB         431 kB
[20:22:40.171] ├ ƒ /_not-found                          146 B          87.4 kB
[20:22:40.171] ├ ƒ /api/detail                          0 B                0 B
[20:22:40.171] ├ ƒ /api/graphql                         0 B                0 B
[20:22:40.171] ├ ƒ /api/preview                         0 B                0 B
[20:22:40.171] ├ ƒ /api/preview/[hash64]                0 B                0 B
[20:22:40.171] ├ ƒ /api/preview/[hash64]/[id]           0 B                0 B
[20:22:40.171] ├ ƒ /api/search                          0 B                0 B
[20:22:40.171] ├ ƒ /api/stats                           0 B                0 B
[20:22:40.171] ├ ƒ /detail                              146 B          87.4 kB
[20:22:40.171] ├ ƒ /detail/[hash64]                     13.1 kB         202 kB
[20:22:40.171] └ ƒ /search                              4.1 kB          431 kB
[20:22:40.171] + First Load JS shared by all            87.3 kB
[20:22:40.171]   ├ chunks/23-ba6c9e349bd0ab2b.js        31.6 kB
[20:22:40.171]   ├ chunks/fd9d1056-f518bdc60ef95b2d.js  53.6 kB
[20:22:40.171]   └ other shared chunks (total)          2 kB
[20:22:40.171] 
[20:22:40.171] 
[20:22:40.171] ƒ  (Dynamic)  server-rendered on demand
[20:22:40.171] 
[20:22:40.396] Traced Next.js server files in: 88.904ms
[20:22:44.210] Created all serverless functions in: 3.813s
[20:22:44.224] Collected static files (public/, static/, .next/static): 11.58ms
[20:22:44.263] Build Completed in /vercel/output [3m]
[20:22:44.434] Deploying outputs...
[20:22:44.436] Injected Vercel Toolbar into the build output, you can disable this in your project settings.
[20:22:54.719] 
[20:22:54.971] Deployment completed
[20:23:02.782] Uploading build cache [85.59 MB]...
[20:23:04.511] Build cache uploaded: 1.729s

页面错误提示

发生意外错误

Message: An error occurred in the Server Components render. The specific message is omitted in production builds to avoid leaking sensitive details. A digest property is included on this error instance which may provide additional details about the nature of the error.

Digest: 4061554357
journey-ad commented 1 month ago

看下运行日志?多半是db没连上

wensley commented 1 month ago

看下运行日志?多半是db没连上

就是这个报错


TypeError: fetch failed
    at node:internal/deps/undici/undici:12502:13
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async a (/var/task/.next/server/chunks/204.js:1:25292)
    at async b (/var/task/.next/server/app/search/page.js:1:10884)
    at async y (/var/task/.next/server/app/search/page.js:1:11462) {
  digest: '4061554357',
  [cause]: Error: connect ECONNREFUSED 127.0.0.1:3000
      at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1606:16)
      at TCPConnectWrap.callbackTrampoline (node:internal/async_hooks:130:17) {
    errno: -111,
    code: 'ECONNREFUSED',
    syscall: 'connect',
    address: '127.0.0.1',
    port: 3000
  }
}
journey-ad commented 1 month ago

环境变量加一条NEXT_PUBLIC_BASE_URL,值是你的站点域名,相关代码: https://github.com/journey-ad/Bitmagnet-Next-Web/blob/f0bb39ee377cc731661225337933b7be1bf434fc/utils/api.ts#L1-L12

后面我看下能不能做到免配置

wensley commented 1 month ago

环境变量加一条NEXT_PUBLIC_BASE_URL,值是你的站点域名,相关代码:

https://github.com/journey-ad/Bitmagnet-Next-Web/blob/f0bb39ee377cc731661225337933b7be1bf434fc/utils/api.ts#L1-L12

后面我看下能不能做到免配置

是在vercel添加环境变量吗?添加后还有报错:

TypeError: Failed to parse URL from bt.xxx.xyz/api/search?keyword=%E7%8C%AB%E5%92%8C%E8%80%81%E9%BC%A0&limit=10&offset=0&sortType=default&filterTime=all&filterSize=all
    at new Request (node:internal/deps/undici/undici:4855:19)
    at a (/var/task/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:180691)
    ... 5 lines matching cause stack trace ...
    at async y (/var/task/.next/server/app/search/page.js:1:11462) {
  digest: '159550915',
  [cause]: TypeError: Invalid URL
      at new URL (node:internal/url:797:36)
      at new Request (node:internal/deps/undici/undici:4853:25)
      at a (/var/task/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:180691)
      at B (/var/task/.next/server/chunks/948.js:2:6846)
      at /var/task/.next/server/chunks/948.js:2:9092
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
      at async a (/var/task/.next/server/chunks/204.js:1:24929)
      at async b (/var/task/.next/server/app/search/page.js:1:10884)
      at async y (/var/task/.next/server/app/search/page.js:1:11462) {
    code: 'ERR_INVALID_URL',
    input: 'bt.xxx.xyz/api/search?keyword=%E7%8C%AB%E5%92%8C%E8%80%81%E9%BC%A0&limit=10&offset=0&sortType=default&filterTime=all&filterSize=all'
  }
}
wensley commented 1 month ago

不着急,等你有时间更新吧,谢谢

journey-ad commented 1 month ago

之前回复里没表述清楚,值是站点url,需要带上协议https://

wensley commented 1 month ago

之前回复里没表述清楚,值是站点url,需要带上协议https://

image

t [ApolloError]: Failed to execute search query
    at new t (/var/task/.next/server/chunks/38.js:1:88954)
    at /var/task/.next/server/chunks/38.js:1:76524
    at o (/var/task/.next/server/chunks/38.js:1:39716)
    at /var/task/.next/server/chunks/38.js:1:39631
    at new Promise (<anonymous>)
    at Object.then (/var/task/.next/server/chunks/38.js:1:39598)
    at Object.next (/var/task/.next/server/chunks/38.js:1:39726)
    at g (/var/task/.next/server/chunks/38.js:1:133784)
    at b (/var/task/.next/server/chunks/38.js:1:134325)
    at t.next (/var/task/.next/server/chunks/38.js:1:134826) {
  graphQLErrors: [
    {
      message: 'Failed to execute search query',
      locations: [Array],
      path: [Array],
      extensions: [Object]
    }
  ],
  protocolErrors: [],
  clientErrors: [],
  networkError: null,
  extraInfo: undefined
}

Failed to fetch: Network response was not ok: Internal Server Error

不好意思啊,我小白就会照教程做的水平表情😂

journey-ad commented 1 month ago

看截图里的错误信息,是不是postgresql服务端限制了必须以ssl连接,或者限制了ip之类的

wensley commented 1 month ago

看截图里的错误信息,是不是postgresql服务端限制了必须以ssl连接,或者限制了ip之类的

image 我用的vercel自带的数据库,数据库配置不是手动设置的,你看需要改哪里吗?