Skip to content

Error: Could not convert argument of type symbol to string. #897

Answered by asuhag113
patrickdevivo asked this question in Q&A
Discussion options

You must be logged in to vote

I also ran into this recently. From what I can tell, at some point (I think in this commit), graphql-request started using the Headers object as opposed to a plain JS object

-   const headers = { ...params.headers }
+   const headers = new Headers(params.headers as HeadersInit)

In my use-case, I was originally modifying and passing headers in a request middleware as such:

const requestMiddleware: RequestMiddleware = async (request) => {
  return {
    ...request,
    headers: {
      ...request.headers,
      Authorization: `Bearer ${await getToken()}`,
    },
  };
};

After the change in the above commit, the resulting headers that are passed look something to the effect of:

{
  headers:…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@patrickdevivo
Comment options

Answer selected by patrickdevivo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
2 participants
Converted from issue

This discussion was converted from issue #892 on June 03, 2024 02:33.