snyk-tech-services / snyk-delta

Other
18 stars 18 forks source link

Error generated when using it against a new branch #42

Closed pstember closed 4 years ago

pstember commented 4 years ago

I am running the tool against a new branch

I used the extra argument baselineProject and baselineOrg to point to an existing project on Snyk but the tool crash.

To reproduce:

  1. Create a new branch
  2. Add a new dependency
  3. Try to run Snyk-delta without committing the branch or pushing to the repo (or monitoring that new transient branch)

CLI output ~/Git/goof >>> snyk test --json --print-deps | snyk-delta --baselineOrg 9813a9b3-xxxx-4c33-xxxx-c1cb9c12xxxx --baselineProject ac3dbab1-xxxx-449f-xxxx-89082744xxxx -d snyk inline mode +0ms snyk Verify input data for JSON structure +534ms snyk Retrieve Snyk Project ac3dbab1-de87-449f-910b-890827442897 in org 9813a9b3-6a54-4c33-bff8-c1cb9c12b7fe +1ms snyk Monitored snapshot had 117 vulns +710ms snyk TypeError: Cannot read property 'filter' of undefined snyk at Object.getNewVulns (/Users/pstember/.npm-packages/lib/node_modules/snyk-delta/src/lib/snyk/issues.ts:22:31) snyk at getDelta (/Users/pstember/.npm-packages/lib/node_modules/snyk-delta/src/lib/index.ts:84:41) snyk at processTicksAndRejections (internal/process/task_queues.js:93:5) +0ms

aarlaud commented 4 years ago

What command do you run? Please share sanitized debug output.

pstember commented 4 years ago

I realised that I am running node v14..9.0 and npm install told me

npm WARN notsup Unsupported engine for snyk-delta@1.2.1: wanted: {"node":"12.x"} (current: {"node":"14.9.0","npm":"6.14.8"})
npm WARN notsup Not compatible with your version of node/npm: snyk-delta@1.2.1

Cleaned debug output

  snyk inline mode +0ms
  snyk Verify input data for JSON structure +1s
  snyk Retrieve Snyk Project ac3dbab1-de87-449f-910b-890827442897 in org 9813a9b3-6a54-4c33-bff8-c1cb9c12b7fe +1ms
  snyk Monitored snapshot had 117 vulns +945ms
  snyk TypeError: Cannot read property 'filter' of undefined
  snyk     at Object.getNewVulns (/Users/pstember/.npm-packages/lib/node_modules/snyk-delta/src/lib/snyk/issues.ts:22:31)
  snyk     at getDelta (/Users/pstember/.npm-packages/lib/node_modules/snyk-delta/src/lib/index.ts:84:41)
  snyk     at processTicksAndRejections (internal/process/task_queues.js:93:5) +0ms
pstember commented 4 years ago

turned out my problem was the snyk test not working as my files were out of sync. Self-resolved at the end :)

Can we aad an error message to suggest running the Snyk command alone as a troubleshooting option? Should work on exit code 2, no?