Skip to content
This repository has been archived by the owner on Apr 2, 2024. It is now read-only.

Upgrade pysnyk to latest #13

Merged
merged 1 commit into from
Feb 13, 2023
Merged

Upgrade pysnyk to latest #13

merged 1 commit into from
Feb 13, 2023

Conversation

tjsilver
Copy link
Contributor

@tjsilver tjsilver commented Feb 13, 2023

Co-authored-by: Natasha [email protected]

What does this change?

Upgrades pysnyk from v.0.9.3 -> v0.9.5 (latest), which fixes the issue of the last few days where the tag monitor was erroring.

Context

Tag monitor started erroring without any changes made by us. The logs revealed this error with the projects.all method:

[ERROR] InvalidFieldValue: Field "totalDependencies" of type int in Project has invalid value None
Traceback (most recent call last):
  File "/var/task/main.py", line 13, in handler
    tag_count: int = delete_tags_and_count(snyk_api_key, snyk_group_id)
  File "/var/task/snyk_helpers.py", line 76, in delete_tags_and_count
    owned_tags = _get_owned_tags(snyk_api_key)
  File "/var/task/snyk_helpers.py", line 68, in _get_owned_tags
    projects: list = client.projects.all()
  File "/var/task/snyk/managers.py", line 172, in all
    return self._query()
  File "/var/task/snyk/managers.py", line 168, in _query
    projects.extend(org.projects.all())
  File "/var/task/snyk/managers.py", line 172, in all
    return self._query()
  File "/var/task/snyk/managers.py", line 163, in _query
    projects.append(self.klass.from_dict(project_data))
  File "<string>", line 85, in from_dict

We printed out the results of that method locally and replicated the error. We experimented with another method on Project such as first, but that also caused the same error.

We do not make use of the totalDependencies field in our code.

We then experimented with upgrading pysnyk and that solved the problem.

@NovemberTang NovemberTang merged commit 7acb14c into main Feb 13, 2023
@NovemberTang NovemberTang deleted the ts-nt/fix-tags branch February 13, 2023 12:44
@akash1810
Copy link
Member

snyk-labs/pysnyk#162 seems relevant, which was fixed in snyk-labs/pysnyk#165. The fix was merged 20 Jan 2023, and IIUC we started seeing errors from 11 Feb 2023. That is, I don't quite understand the timeline.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants