Open tchanxx opened 2 months ago
the examples in the documentation have relative urls, so /api/tina/gql should work. It looks like you might be on older version of @tinacms/cli
and @tinacms/datalayer
, though, so try upgrading those and see if that resolves the issue.
Thanks for the reply @kldavis4 . I updated all of my packages, and I still get the same error.
I narrowed it down to this generated code:
// TinaSDK generated code
import { createClient, TinaClient } from "tinacms/dist/client";
const generateRequester = (
client: TinaClient,
options?: { branch?: string }
) => {
const requester: (
doc: any,
vars?: any,
options?: { branch?: string },
client
) => Promise<any> = async (doc, vars, options) => {
let url = client.apiUrl
if (options?.branch) {
const index = client.apiUrl.lastIndexOf('/')
url = client.apiUrl.substring(0, index + 1) + options.branch
}
const data = await client.request({
query: doc,
variables: vars,
url,
})
return { data: data?.data, errors: data?.errors, query: doc, variables: vars || {} }
}
return requester
}
It is failing at:
const data = await client.request({
query: doc,
variables: vars,
url,
})
Anyway, oddly enough, I was able to fix this problem by avoiding all of the client
and replacing them with databaseClient
Describe the issue that you're seeing. Any Loom videos or screenshots usually help a lot!
Hi, I am trying to self-host the Tina Node backend.
I noticed that when I set
contentApiUrlOverride
to an absolute URL likecontentApiUrlOverride: "http://localhost:3000/api/tina/gql"
everything works as expected locally.However, when I set
contentApiUrlOverride
to a relative url path like/api/tina/gql
like the docs say, I get:I would use the absolute URL, but this doesn't work for production purposes since Vercel won't give me the absolute URL while building.
Any ideas?
Reproduction
N/A
Steps to reproduce
No response
System Info
Validations