Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node TypeError when running against an organization #2

Closed
vEpiphyte opened this issue Jan 6, 2023 · 2 comments · Fixed by #7
Closed

Node TypeError when running against an organization #2

vEpiphyte opened this issue Jan 6, 2023 · 2 comments · Fixed by #7

Comments

@vEpiphyte
Copy link

When running this against an organization, this produced a node error.

...
? Enter your CircleCI API token [hidden]
? Enter your GitHub API token [hidden]
? Select an account fooOrganization
? Is this an Organization (Not a User)? Yes
file:///project/index.js:149
USER_DATA.projects = repoData.filter((repo) => repo.variables.length > 0);
                                                              ^

TypeError: Cannot read properties of undefined (reading 'length')
    at file:///project/index.js:149:63
    at Array.filter (<anonymous>)
    at file:///project/index.js:149:31
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Node.js v19.3.0
@rstudner
Copy link

rstudner commented Jan 6, 2023

USER_DATA.projects = repoData.filter((repo) => {
  if (repo && repo.variables) {
    return repo.variables.length > 0;
  } else {
    return false;
  }
});

@vEpiphyte
Copy link
Author

@rstudner That worked! Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants