Use GOOGLE_CLOUD_PROJECT instead of GAE_APPLICATION

This commit is contained in:
Michael Jackson 2019-08-05 09:17:26 -07:00
parent 370a7f7d6c
commit 8aa619727e
2 changed files with 22 additions and 7 deletions

View File

@ -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;

View File

@ -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;
}
@ -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;
}