tinacms/tina-self-hosted-demo

TypeError: Failed to parse URL from /api/tina/gql

avcohen opened this issue · 3 comments

Cloned repo, followed setup instructions to a T.

As noted in title, getting an error at first run of the starter.

 ⨯ TypeError: Failed to parse URL from /api/tina/gql
    at Object.fetch (node:internal/deps/undici/undici:11730:11)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async TinaClient.request (file:///Users/aaroncohen/dev/web/handstand/node_modules/tinacms/dist/client.mjs:33:17)
    at async requester (webpack-internal:///./tina/__generated__/types.ts:193:22)
    at async getStaticProps (webpack-internal:///./pages/index.tsx:43:23) {
  page: '/',
  [cause]: TypeError: Invalid URL
      at new URL (node:internal/url:775:36)
      at new Request (node:internal/deps/undici/undici:5270:25)
      at fetch (node:internal/deps/undici/undici:9508:25)
      at Object.fetch (node:internal/deps/undici/undici:11728:18)
      at fetch (node:internal/process/pre_execution:314:27)
      at TinaClient.request (file:///Users/aaroncohen/dev/web/handstand/node_modules/tinacms/dist/client.mjs:33:23)
      at requester (webpack-internal:///./tina/__generated__/types.ts:193:35)
      at Object.page (webpack-internal:///./tina/__generated__/types.ts:177:20)
      at getStaticProps (webpack-internal:///./pages/index.tsx:43:100)
      at /Users/aaroncohen/dev/web/handstand/node_modules/next/dist/compiled/next-server/pages.runtime.dev.js:17:4070
      at /Users/aaroncohen/dev/web/handstand/node_modules/next/dist/server/lib/trace/tracer.js:133:36
      at NoopContextManager.with (/Users/aaroncohen/dev/web/handstand/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:7062)
      at ContextAPI.with (/Users/aaroncohen/dev/web/handstand/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:518)
      at NoopTracer.startActiveSpan (/Users/aaroncohen/dev/web/handstand/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:18093)
      at ProxyTracer.startActiveSpan (/Users/aaroncohen/dev/web/handstand/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:18854) {
    code: 'ERR_INVALID_URL',
    input: '/api/tina/gql'

I fixed this problem by setting contentApiUrlOverride to http://localhost:4001/graphql

This is a good answer, but in order to provide more flexibility, i used process.env.NEXT_PUBLIC_SITE_URL+"/api/tina/gql".