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

github sync nonetype error when listing collaborators #1404

Closed
achantavy opened this issue Dec 12, 2024 · 2 comments
Closed

github sync nonetype error when listing collaborators #1404

achantavy opened this issue Dec 12, 2024 · 2 comments

Comments

@achantavy
Copy link
Contributor

Title:
GitHub sync crashes when listing collaborators with a Nonetype error;

Description:

What issue is being seen? Describe what should be happening instead of the bug, for example: Cartography should not crash, the expected value isn't returned, the data schema is wrong, etc.

Similar as #1334.

To Reproduce:

Steps to reproduce the behavior. Provide all data and inputs required to reproduce the issue.

Run github sync. I guess this becomes more pronounced on a large enough graph or in conditions when your github quota is low or some other condition is flaky.

Logs:

If applicable, copy and paste your console log with the failing stack trace.

Crash

Traceback (most recent call last):
  ...
  File "{PATH}app/intelmodules/github.py", line 321, in sync_repos
    direct_collabs = _get_repo_collaborators_for_multiple_repos(
  File "{PATH}/cartography/intel/github/repos.py", line 160, in _get_repo_collaborators_for_multiple_repos
    (affiliation == 'DIRECT' and repo['directCollaborators']['totalCount'] == 0)):
TypeError: 'NoneType' object is not subscriptable

Screenshots:

If applicable, add screenshots to help explain your problem.

Please complete the following information::

  • Cartography release version or commit hash [e.g. 0.12.0 or 95e8e11]

0.96.0

cc: @danbrauer - any chance you have time to help here? maybe adding a retry + sleep of some sort, either with your decorator technique or the older technique. np if you're busy!

@danbrauer
Copy link
Contributor

danbrauer commented Dec 12, 2024

@achantavy I see! I knew less when I did this a few weeks ago. It would be easy to add in the nonetype checking. Is it okay if I do it tomorrow (Fri Dec 13)? I should be able to do it fairly easily with the same backoff generator approach, I just am not really online today.

@danbrauer
Copy link
Contributor

@achantavy upd I did push a tix to a draft PR just now, in case this is urgent: #1405

But as noted there I did not yet have a chance to add testing or sanity check beyond running make test. I will mostly not be here today, apologies. I can look to the other stuff tmmw, as noted.

achantavy pushed a commit that referenced this issue Dec 13, 2024
…ollaborators (#1409)

### Summary
> Describe your changes.

Allows the GitHub sync to continue if the user is unable to list
repository collaborators.


### Checklist

Provide proof that this works (this makes reviews move faster). Please
perform one or more of the following:
- [x] Update/add unit or integration tests.
- [x] Include a screenshot showing what the graph looked like before and
after your changes.
- [ ] Include console log trace showing what happened before and after
your changes.

If you are changing a node or relationship:
- [ ] Update the
[schema](https://github.com/lyft/cartography/tree/master/docs/root/modules)
and
[readme](https://github.com/lyft/cartography/blob/master/docs/schema/README.md).

If you are implementing a new intel module:
- [ ] Use the NodeSchema [data
model](https://cartography-cncf.github.io/cartography/dev/writing-intel-modules.html#defining-a-node).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants