Skip to content

Commit

Permalink
Use GOOGLE_CLOUD_PROJECT instead of GAE_APPLICATION
Browse files Browse the repository at this point in the history
  • Loading branch information
mjackson committed Aug 5, 2019
1 parent 370a7f7 commit 8aa6197
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 7 deletions.
2 changes: 1 addition & 1 deletion modules/middleware/requestLog.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import util from 'util';

// https://cloud.google.com/appengine/docs/standard/nodejs/runtime#environment_variables
const projectId = process.env.GAE_APPLICATION;
const projectId = process.env.GOOGLE_CLOUD_PROJECT;

const enableDebugging = process.env.DEBUG != null;

Expand Down
27 changes: 21 additions & 6 deletions modules/utils/npm.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,18 @@ async function fetchPackageInfo(packageName, log) {
return bufferStream(res).then(JSON.parse);
}

if (res.statusCode === 404) {
return null;
}

const content = (await bufferStream(res)).toString('utf-8');

log.error('Failed to fetch info for %s', packageName);
log.error('Status: %s', res.statusCode);
log.error('Content: %s', content);
log.error(
'Error fetching info for %s (status: %s)',
packageName,
res.statusCode
);
log.error(content);

return null;
}
Expand Down Expand Up @@ -181,11 +188,19 @@ export async function getPackage(packageName, version, log) {
return stream;
}

if (res.statusCode === 404) {
return null;
}

const content = (await bufferStream(res)).toString('utf-8');

log.error('Failed to fetch tarball for %s@%s', packageName, version);
log.error('Status: %s', res.statusCode);
log.error('Content: %s', content);
log.error(
'Error fetching tarball for %s@%s (status: %s)',
packageName,
version,
res.statusCode
);
log.error(content);

return null;
}

0 comments on commit 8aa6197

Please sign in to comment.