Make sure the awslambda check only returns a boolean

This commit is contained in:
Sparticuz 2023-03-27 09:21:44 -04:00
parent 38e10469c5
commit b57702b414
1 changed files with 13 additions and 3 deletions

View File

@ -17,9 +17,19 @@ export const isValidUrl = (input: string) => {
} }
}; };
export const isRunningInAwsLambda = () => /**
* Determines if the running instance is inside an AWS Lambda container.
* @returns
*/
export const isRunningInAwsLambda = () => {
if (
process.env.AWS_EXECUTION_ENV && process.env.AWS_EXECUTION_ENV &&
/^AWS_Lambda_nodejs/.test(process.env.AWS_EXECUTION_ENV) === true; /^AWS_Lambda_nodejs/.test(process.env.AWS_EXECUTION_ENV) === true
) {
return true;
}
return false;
};
export const downloadAndExtract = async (url: string) => export const downloadAndExtract = async (url: string) =>
new Promise<string>((resolve, reject) => { new Promise<string>((resolve, reject) => {