What's the possible reason to raise the error of "Cannot read property 'projectId' of undefined"?


"message": "Cannot read property 'projectId' of undefined",
"name": "FUNCTION_ERR",
"stack": "TypeError: Cannot read property 'projectId' of undefined\n at getProjects (index.js:36661:35)\n at async index.js:1656:21\n at async asyncMap (index.js:1587:24)\n at async index.js:1608:29\n at async index.js:1076:31",


export const getDataFromJira = async url => {
  try {
    const response = await api.asUser().requestJira(url);
    const result = await response.json();
    return result;
  } catch (error) {
    console.log("getDataFromJira error: ", error);
    throw error;

export const getProjects = async() => {
  const response = await getDataFromJira(route`/rest/agile/1.0/board?type=scrum`);
  if (!response) return []

  let projects = []

  for(let board of response.values){
    if (!projects.some(item => item.projectKey === board?.location?.projectKey)){
  return [...projects].sort((a, b) => a.projectName > b.projectName? 1: -1);

PS: Invocation ID: 42b8e5f2-efff-43bb-aca3-d0b6a4407248

Just theoretically:
you are using the end point described here.
According to the examples there, returned boards don’t have location member/variable.

projects.some(item => item.projectKey === board?.location?.projectKey))

will always return false and thus the condition in if will be always true. In result you are trying to do operation:


which will fail as according to the examples returned by the API boards don’t have location member.

1 Like

Thanks ZbigniewPiecuch.
As you suggest, the user case is that no location exists for a specified scrum board. But I don’t know how to reproduce this scenario.