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'; import util from 'util';
// https://cloud.google.com/appengine/docs/standard/nodejs/runtime#environment_variables // 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; const enableDebugging = process.env.DEBUG != null;

View File

@ -62,11 +62,18 @@ async function fetchPackageInfo(packageName, log) {
return bufferStream(res).then(JSON.parse); return bufferStream(res).then(JSON.parse);
} }
if (res.statusCode === 404) {
return null;
}
const content = (await bufferStream(res)).toString('utf-8'); const content = (await bufferStream(res)).toString('utf-8');
log.error('Failed to fetch info for %s', packageName); log.error(
log.error('Status: %s', res.statusCode); 'Error fetching info for %s (status: %s)',
log.error('Content: %s', content); packageName,
res.statusCode
);
log.error(content);
return null; return null;
} }
@ -181,11 +188,19 @@ export async function getPackage(packageName, version, log) {
return stream; return stream;
} }
if (res.statusCode === 404) {
return null;
}
const content = (await bufferStream(res)).toString('utf-8'); const content = (await bufferStream(res)).toString('utf-8');
log.error('Failed to fetch tarball for %s@%s', packageName, version); log.error(
log.error('Status: %s', res.statusCode); 'Error fetching tarball for %s@%s (status: %s)',
log.error('Content: %s', content); packageName,
version,
res.statusCode
);
log.error(content);
return null; return null;
} }