Skip to main content
Solved

Info {"errors":[{"message":"Unexpected end of document","locations":[]}]}

  • January 18, 2022
  • 1 reply
  • 1927 views

davi96
  • New Participant
  • 4 replies

I’m trying to get data from a pipe using Google Apps Script and keep getting the error:

Info	{"errors":[{"message":"Unexpected end of document","locations":[]}]}

I don’t think the problem is with the general script’s structure, since it works when I run another query.

Also, I’m new to GRAPHQL - this is the first time I use it, for instance - so that’s another reason why I believe the problem might be in the query.

A piece of the script I used to try is:

  const query = `{
  allCards(pipe_id:${pipe_id}){
    edges{
      node {
        title
        current_phase {
          name
        }
        createdBy {
          name
        }
        createdAt
        fields {
          value
          name
        }
      }
    }
  }`;
  const graphql = JSON.stringify({
    query: query,
    variables: null,
  });
  const params = {
    method: "GET",
    payload: graphql,
    headers: {
      "Content-Type": "application/json",
      Authorization: `Bearer ${TOKEN}`,
    },
  };
  var response = UrlFetchApp.fetch(url, params);

pipe_id and TOKEN and variables defined previously in the script.

 

Also, something that I didn’t set yet are the filters: I’d like to take data only from the cards in specific phases for which I have the names (example: phase_1, phase_2...).

 

My final goal is to take the data object and transform it to build a table with columns [Title, Current Phase Name, Creator’s Name, Created At, Specific Field Name] and where each row will represent a card’s info. 

Best answer by davi96

Solution: there was one } missing in the query variable.

View original
Did this topic help you find an answer to your question?

1 reply

davi96
  • Author
  • New Participant
  • 4 replies
  • Answer
  • January 18, 2022

Solution: there was one } missing in the query variable.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings