node -v: v10.9.0npm -v: 6.2.0snyk -v: 1.90.2It completes without failure or reports what patch is failing. It was only when I added --debug that it expose the fact that it was trying to apply a patch mentioned in .snyk. The error should report that it can't find a patch listed in the .snyk file.
> snyk protect
Failed to fetch patch file
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] snyk-protect: `snyk protect`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] snyk-protect script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
package.json setup as Snyk bot wanted it https://github.com/hmcts/ccd-case-print-service/commit/d04d49a031a32f88ee383d353d99b26bb25a29b6
yarn install
npm run snyk-protect
If applicable, please append the --debug flag on your command and include the output here **ensuring to remove any sensitive/personal details or tokens.
I'm also experiencing this issue, immediately after running snyk wizard or when running snyk protect to setup snyk on a project.
It fails with Failed to fetch patch file - here's the full error:
snyk protect { _: [ [Circular] ], debug: true } +0ms
snyk no file specified. Trying to autodetect in base folder [REDACTED] +0ms
snyk found package file yarn.lock in [REDACTED] +0ms
snyk ~~~~ LIVE RUN ~~~~ +0ms
snyk no file specified. Trying to autodetect in base folder [REDACTED] +31ms
snyk found package file yarn.lock in [REDACTED] +0ms
snyk analytics add local true +0ms
snyk policies found [ '[REDACTED]',
'[REDACTED]/node_modules/snyk' ] +0ms
snyk analytics add policies 2 +4s
snyk analytics add packageManager npm +60ms
snyk analytics add packageName [REDACTED] +0ms
snyk analytics add packageVersion [REDACTED] +0ms
snyk analytics add package [REDACTED]@[REDACTED] +0ms
snyk sending request to: https://snyk.io/api/v1/vuln/npm/patches +0ms
snyk request body size: 3407039 +0ms
snyk gzipped request body size: 175896 +0ms
snyk analytics add payloadSize 3407039 +94ms
snyk analytics add gzippedPayloadSize 175896 +0ms
snyk not using proxy +1ms
snyk analytics add vulns-pre-policy 27 +307ms
snyk analytics add vulns 27 +2ms
snyk patching 27 vulns after dedupe +0ms
snyk analytics add patch [email protected] > [email protected] > [email protected] > [email protected] > [email protected] +11ms
snyk analytics add patch-fetch-fail { message: 'Failed to fetch patch file', code: 403 } +1s
snyk analytics add success false +1ms
snyk analytics add error-message Failed to fetch patch file +1ms
snyk analytics add error Error: Failed to fetch patch file
at PassThrough.<anonymous> ([REDACTED].local/share/yarn/global/node_modules/snyk/lib/protect/fetch-patch.js:23:23)
at emitOne (events.js:116:13)
at PassThrough.emit (events.js:211:7)
at ClientRequest.<anonymous> ([REDACTED].local/share/yarn/global/node_modules/needle/lib/needle.js:482:9)
at Object.onceWrapper (events.js:315:30)
at emitOne (events.js:116:13)
at ClientRequest.emit (events.js:211:7)
at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:543:21)
at HTTPParser.parserOnHeadersComplete (_http_common.js:112:17)
at TLSSocket.socketOnData (_http_client.js:440:20) +1ms
snyk analytics add error-code undefined +0ms
snyk analytics add command protect +0ms
Error: Failed to fetch patch file
at PassThrough.<anonymous> ([REDACTED].local/share/yarn/global/node_modules/snyk/lib/protect/fetch-patch.js:23:23)
at emitOne (events.js:116:13)
at PassThrough.emit (events.js:211:7)
at ClientRequest.<anonymous> ([REDACTED].local/share/yarn/global/node_modules/needle/lib/needle.js:482:9)
at Object.onceWrapper (events.js:315:30)
at emitOne (events.js:116:13)
at ClientRequest.emit (events.js:211:7)
at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:543:21)
at HTTPParser.parserOnHeadersComplete (_http_common.js:112:17)
at TLSSocket.socketOnData (_http_client.js:440:20)
snyk analytics { command: 'bad-command',
args:
[ { debug: true,
loose: true,
vulnEndpoint: '/vuln/npm/patches',
packageManager: 'yarn',
file: 'package.json' } ],
metadata:
{ local: true,
policies: 2,
packageManager: 'npm',
packageName: '[REDACTED]',
packageVersion: '[REDACTED]',
package: '[REDACTED]@[REDACTED]',
payloadSize: 3407039,
gzippedPayloadSize: 175896,
'vulns-pre-policy': 27,
vulns: 27,
patch: '[email protected] > [email protected] > [email protected] > [email protected] > [email protected]',
'patch-fetch-fail': { message: 'Failed to fetch patch file', code: 403 },
success: false,
'error-message': 'Failed to fetch patch file',
error: 'Error: Failed to fetch patch file\n at PassThrough.<anonymous> ([REDACTED].local/share/yarn/global/node_modules/snyk/lib/protect/fetch-patch.js:23:23)\n at emitOne (events.js:116:13)\n at PassThrough.emit (events.js:211:7)\n at ClientRequest.<anonymous> ([REDACTED].local/share/yarn/global/node_modules/needle/lib/needle.js:482:9)\n at Object.onceWrapper (events.js:315:30)\n at emitOne (events.js:116:13)\n at ClientRequest.emit (events.js:211:7)\n at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:543:21)\n at HTTPParser.parserOnHeadersComplete (_http_common.js:112:17)\n at TLSSocket.socketOnData (_http_client.js:440:20)',
'error-code': undefined,
command: 'protect' },
version: '1.90.2',
os: 'Linux 4.18',
nodeVersion: 'v8.11.4',
id: '[REDACTED]',
ci: false,
durationMs: 6039 } +3ms
snyk sending request to: https://snyk.io/api/v1/analytics/cli +1s
snyk request body size: 1438 +0ms
snyk gzipped request body size: 719 +0ms
snyk not using proxy +0ms
With --debug I'm also seeing the same 403 that @fekle reports.
Hi @dwaynebailey and @fekle. I am sorry, but we had some temporary hiccup in patch avaialability. It shouldbe gone now and everything should behave as usual.
I am going to close this issue. Feel free to reopen if you would still experience any problems.
@miiila Can confirm it works again for me, thanks a lot!