Hi, I'm trying to use the graphql-request library but I'm getting an error that says ...not a valid key=value pair (missing equal-sign) in Authorization header: 'Token ...'.
The code in question looks something like this:
const client = new GraphQLClient('https://my-repo.prismic.io/graphql', {
headers: {
'Prismic-Ref': 'ref', // manually added for now
"Authorization": `Token ${process.env.PRISMIC_API_TOKEN}` // properly loaded env via '.env.local'
}
})
// ... some lines of code that does the request
The framework I'm using is Next.js so assume that this is called on the server-side.
My goal is to be able to use graphql-request along with react-query from generated code (graqphl-codegen).
Hi @Pau, thank you for the reply. Yes, I have used Apollo before, but I thought to try out another library and compare the speed of development. I guess I could use Apollo, but I thought to ask in case anyone has experience with graphql-request.
Another thing I realized is that this issue also occurs when I configure an IntelliJ plugin called JS GraphQL.