Darmau / koktohay-next

可可托海没有海的前端项目
https://darmau.design
36 stars 7 forks source link

ApolloError: Failed to parse URL from /graphql #23

Closed CaptainRuby closed 1 year ago

CaptainRuby commented 1 year ago

yarn dev  ✔  took 1m 17s   at 14:39:04  yarn run v1.22.19 $ next dev ready - started server on 0.0.0.0:3000, url: http://localhost:3000 event - compiled client and server successfully in 1947 ms (919 modules) wait - compiling... event - compiled successfully in 149 ms (834 modules) wait - compiling / (client and server)... event - compiled client and server successfully in 250 ms (949 modules) error - ApolloError: Failed to parse URL from /graphql at new ApolloError (/Users/rubyke/Downloads/koktohay-next-main/node_modules/@apollo/client/errors/errors.cjs:34:28) at /Users/rubyke/Downloads/koktohay-next-main/node_modules/@apollo/client/core/core.cjs:1853:19 at both (/Users/rubyke/Downloads/koktohay-next-main/node_modules/@apollo/client/utilities/utilities.cjs:1072:53) at /Users/rubyke/Downloads/koktohay-next-main/node_modules/@apollo/client/utilities/utilities.cjs:1065:72 at new Promise () at Object.then (/Users/rubyke/Downloads/koktohay-next-main/node_modules/@apollo/client/utilities/utilities.cjs:1065:24) at Object.error (/Users/rubyke/Downloads/koktohay-next-main/node_modules/@apollo/client/utilities/utilities.cjs:1073:49) at notifySubscription (/Users/rubyke/Downloads/koktohay-next-main/node_modules/zen-observable/lib/Observable.js:140:18) at onNotify (/Users/rubyke/Downloads/koktohay-next-main/node_modules/zen-observable/lib/Observable.js:179:3) at SubscriptionObserver.error (/Users/rubyke/Downloads/koktohay-next-main/node_modules/zen-observable/lib/Observable.js:240:7) at /Users/rubyke/Downloads/koktohay-next-main/node_modules/@apollo/client/utilities/utilities.cjs:1055:68 at Array.forEach () at iterateObserversSafely (/Users/rubyke/Downloads/koktohay-next-main/node_modules/@apollo/client/utilities/utilities.cjs:1055:25) at Object.error (/Users/rubyke/Downloads/koktohay-next-main/node_modules/@apollo/client/utilities/utilities.cjs:1159:21) at notifySubscription (/Users/rubyke/Downloads/koktohay-next-main/node_modules/zen-observable/lib/Observable.js:140:18) at onNotify (/Users/rubyke/Downloads/koktohay-next-main/node_modules/zen-observable/lib/Observable.js:179:3) at SubscriptionObserver.error (/Users/rubyke/Downloads/koktohay-next-main/node_modules/zen-observable/lib/Observable.js:240:7) at handleError (/Users/rubyke/Downloads/koktohay-next-main/node_modules/@apollo/client/link/http/http.cjs:296:67) at /Users/rubyke/Downloads/koktohay-next-main/node_modules/@apollo/client/link/http/http.cjs:582:48 { graphQLErrors: [], clientErrors: [], networkError: TypeError: Failed to parse URL from /graphql at Object.fetch (node:internal/deps/undici/undici:11457:11) { [cause]: TypeError [ERR_INVALID_URL]: Invalid URL at new NodeError (node:internal/errors:399:5) at new URL (node:internal/url:556:13) at new Request (node:internal/deps/undici/undici:7041:25) at fetch2 (node:internal/deps/undici/undici:10598:25) at Object.fetch (node:internal/deps/undici/undici:11455:18) at fetch (node:internal/process/pre_execution:234:25) at /Users/rubyke/Downloads/koktohay-next-main/node_modules/@apollo/client/link/http/http.cjs:570:13 at new Subscription (/Users/rubyke/Downloads/koktohay-next-main/node_modules/zen-observable/lib/Observable.js:197:34) at Observable.subscribe (/Users/rubyke/Downloads/koktohay-next-main/node_modules/zen-observable/lib/Observable.js:279:14) at Object.complete (/Users/rubyke/Downloads/koktohay-next-main/node_modules/@apollo/client/utilities/utilities.cjs:1184:43) at Concast.start (/Users/rubyke/Downloads/koktohay-next-main/node_modules/@apollo/client/utilities/utilities.cjs:1211:23) at new Concast (/Users/rubyke/Downloads/koktohay-next-main/node_modules/@apollo/client/utilities/utilities.cjs:1203:19) at QueryManager.getObservableFromLink (/Users/rubyke/Downloads/koktohay-next-main/node_modules/@apollo/client/core/core.cjs:1788:35) at QueryManager.getResultsFromLink (/Users/rubyke/Downloads/koktohay-next-main/node_modules/@apollo/client/core/core.cjs:1828:40) at resultsFromLink (/Users/rubyke/Downloads/koktohay-next-main/node_modules/@apollo/client/core/core.cjs:2005:58) at QueryManager.fetchQueryByPolicy (/Users/rubyke/Downloads/koktohay-next-main/node_modules/@apollo/client/core/core.cjs:2031:21) at fromVariables (/Users/rubyke/Downloads/koktohay-next-main/node_modules/@apollo/client/core/core.cjs:1879:40) at QueryManager.fetchQueryObservable (/Users/rubyke/Downloads/koktohay-next-main/node_modules/@apollo/client/core/core.cjs:1894:15) at QueryManager.fetchQuery (/Users/rubyke/Downloads/koktohay-next-main/node_modules/@apollo/client/core/core.cjs:1497:21) at QueryManager.query (/Users/rubyke/Downloads/koktohay-next-main/node_modules/@apollo/client/core/core.cjs:1582:21) at ApolloClient.query (/Users/rubyke/Downloads/koktohay-next-main/node_modules/@apollo/client/core/core.cjs:2203:34) at getServerSideProps (webpack-internal:///./pages/index.tsx:192:84) at /Users/rubyke/Downloads/koktohay-next-main/node_modules/next/dist/server/render.js:508:110 at /Users/rubyke/Downloads/koktohay-next-main/node_modules/next/dist/server/lib/trace/tracer.js:66:32 at NoopContextManager.with (/Users/rubyke/Downloads/koktohay-next-main/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:7054) at ContextAPI.with (/Users/rubyke/Downloads/koktohay-next-main/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:517) at NoopTracer.startActiveSpan (/Users/rubyke/Downloads/koktohay-next-main/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:18022) at ProxyTracer.startActiveSpan (/Users/rubyke/Downloads/koktohay-next-main/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:18782) at runWithContext (/Users/rubyke/Downloads/koktohay-next-main/node_modules/next/dist/server/lib/trace/tracer.js:60:164) at NextTracerImpl.trace (/Users/rubyke/Downloads/koktohay-next-main/node_modules/next/dist/server/lib/trace/tracer.js:61:16) at Object.renderToHTML (/Users/rubyke/Downloads/koktohay-next-main/node_modules/next/dist/server/render.js:508:51) at async doRender (/Users/rubyke/Downloads/koktohay-next-main/node_modules/next/dist/server/base-server.js:809:34) at async cacheEntry1.responseCache.get.incrementalCache.incrementalCache (/Users/rubyke/Downloads/koktohay-next-main/node_modules/next/dist/server/base-server.js:929:28) at async /Users/rubyke/Downloads/koktohay-next-main/node_modules/next/dist/server/response-cache/index.js:83:36 { input: '/graphql', code: 'ERR_INVALID_URL' } }, extraInfo: undefined, page: '/' } wait - compiling /_error (client and server)... event - compiled client and server successfully in 68 ms (950 modules)

请教一下这个graphql是需要做什么配置吗

Darmau commented 1 year ago

你已经配置好strapi了吗?

CaptainRuby commented 1 year ago

@Darmau 没有,我以为这就是一个完整的项目了

Darmau commented 1 year ago

这个只是前端,就是把 https://github.com/Darmau/koktohay-cms 里的数据取回并显示,如果数据源不对就跑不起来

CaptainRuby commented 1 year ago

@Darmau ok,我试着部署下cms这个项目

Darmau commented 1 year ago

要不先等等,因为这个cms也要数据类型完全对上才能成功,我白天把线上版代码传上来再试。或者等我把strapi里数据是怎么设置的写到文档里。

CaptainRuby commented 1 year ago

好的,我特别喜欢你的博客样式,希望能用上,可以等等

Darmau commented 1 year ago

cms已更新代码

CaptainRuby commented 1 year ago

@Darmau 3Q~!!!

Darmau commented 1 year ago

运行之前记得先准备好postgresql

CaptainRuby commented 1 year ago

好嘞