From ad3ac0967c0aa64ea4d8de8f4281a66e0acaec84 Mon Sep 17 00:00:00 2001 From: Rhys Arkins <rhys@arkins.net> Date: Tue, 17 Jul 2018 19:24:05 +0200 Subject: [PATCH] refactor: log npmjs headers --- lib/datasource/npm.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/lib/datasource/npm.js b/lib/datasource/npm.js index 667dfa5caa..061fdd6864 100644 --- a/lib/datasource/npm.js +++ b/lib/datasource/npm.js @@ -143,12 +143,25 @@ async function getDependencyInner(name, retries = 5) { // Retrieve from API if not cached try { - const res = (await got(pkgUrl, { + const raw = await got(pkgUrl, { cache: process.env.RENOVATE_SKIP_CACHE ? undefined : map, json: true, retries: 5, headers, - })).body; + }); + // istanbul ignore if + if (regUrl === 'https://registry.npmjs.org' && name.startsWith('@')) { + // npmjs is having problems with scoped package consistency so we are debug logging headers until the problem goes away + logger.debug( + { + name, + latest: res['dist-tags'].latest, + headers: raw.headers, + }, + 'npmjs res.headers for scoped packages' + ); + } + const res = raw.body; if (!(res.name && res.name.toLowerCase() === name.toLowerCase())) { logger.warn( { lookupName: name, returnedName: res.name, regUrl }, -- GitLab