Skip to main content

ID! column type value error

  • January 3, 2024
  • 3 replies
  • 326 views

Hello ,
I have very simple code using monday javascript sdk as below.


import mondaySdk from "monday-sdk-js";

const token ="mytoken";
const client = mondaySdk();
client.setToken(token);
client.setApiVersion("2023-10");
const res = await client.api(
  `
query listGroups($boardId:ID!)
{
    boards(ids : [$boardId])
    {
        groups{
            id
            title
        }
    }
}`,
  { boardId: "1835515014" }
);

console.log(res)

But i’m keep getting this error saying invalid value.

{
  errors: [
    {
      message: 'Variable $boardId of type ID! was provided invalid value',
      locations: [Array],
      extensions: [Object]
    }
  ],
  account_id: 20529253
}

EDIT : I tested same graphql query using postman, it’s working fine there.
If anyone can help me with this?
Thanks.

3 replies

  • Participating Frequently
  • January 3, 2024

The client.api method takes a query string as the first argument, the second argument is an object with multiple other parameters, one of those is variables. You need to pass the {boardId: "312312312"} as the variables parameter. See below for the edit:

import mondaySdk from "monday-sdk-js";

const token ="mytoken";
const client = mondaySdk();
client.setToken(token);
client.setApiVersion("2023-10");
const res = await client.api(
  `
query listGroups($boardId:ID!)
{
    boards(ids : [$boardId])
    {
        groups{
            id
            title
        }
    }
}`,
  {variables:{ boardId: "1835515014" }}
);

console.log(res)

  • Author
  • New Participant
  • January 4, 2024

Thank you @anon29275264 ,
It’s working!!


Matias.Monday
Forum|alt.badge.img
  • monday.com Team Member
  • January 4, 2024

Thank you @anon29275264 !!!