I was using the pysnyk package to pull a dependency graph for a project that had a project type of dockerfile, and it raised this exception:
ValueError: Argument for snyk.models.DependencyGraph.from_dict method should be a dict instance
This exception isn't intuitive, and at first glance it appears that the Snyk SDK wasn't compatible with the response from the Snyk API.
I raised a ticket with Snyk support, and I was told that the reason the exception was being raised was because the dependency graph API endpoint only supports specific package managers (see here).
The Snyk API should raise a more helpful exception to help end users understand that the project they are trying to get the dependency graph for isn't currently supported.
Steps To Reproduce
import snyk # from https://pypi.org/project/pysnyk/
snyk_client = snyk.SnykClient("<put-snyk-api-token-here>")
org = snyk_client.organizations.get("<put-org-id-with-project-that-has-dockerfile-as-type>")
[p.dependency_graph for p in org.projects.all()]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 1, in <listcomp>
File "/Path/to/virtual_env/.venv/lib/python3.9/site-packages/snyk/models.py", line 647, in dependency_graph
return Manager.factory(DependencyGraph, self.organization.client, self).all()
File "/Path/to/virtual_env/.venv/lib/python3.9/site-packages/snyk/managers.py", line 377, in all
return self.klass.from_dict(dependency_data["depGraph"])
File "<string>", line 43, in from_dict
ValueError: Argument for snyk.models.DependencyGraph.from_dict method should be a dict instance
Is there an existing issue for this?
Description of the bug
I was using the pysnyk package to pull a dependency graph for a project that had a project type of
dockerfile
, and it raised this exception:This exception isn't intuitive, and at first glance it appears that the Snyk SDK wasn't compatible with the response from the Snyk API.
I raised a ticket with Snyk support, and I was told that the reason the exception was being raised was because the dependency graph API endpoint only supports specific package managers (see here).
The Snyk API should raise a more helpful exception to help end users understand that the project they are trying to get the dependency graph for isn't currently supported.
Steps To Reproduce
Additional Information
No response