Merge pull request #98 from Sparticuz/fix/netlify

This commit is contained in:
Kyle McNally 2023-05-05 14:39:47 -04:00 committed by GitHub
commit b21fdacfc3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 6 deletions

8
package-lock.json generated
View File

@ -16,7 +16,7 @@
"@tsconfig/node16": "^1.0.3", "@tsconfig/node16": "^1.0.3",
"@tsconfig/strictest": "^2.0.1", "@tsconfig/strictest": "^2.0.1",
"@types/follow-redirects": "^1.14.1", "@types/follow-redirects": "^1.14.1",
"@types/node": "^18.16.3", "@types/node": "^18.16.4",
"@types/tar-fs": "^2.0.1", "@types/tar-fs": "^2.0.1",
"clean-modules": "^2.0.6", "clean-modules": "^2.0.6",
"typescript": "^5.0.4" "typescript": "^5.0.4"
@ -47,9 +47,9 @@
} }
}, },
"node_modules/@types/node": { "node_modules/@types/node": {
"version": "18.16.3", "version": "18.16.4",
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.16.3.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-18.16.4.tgz",
"integrity": "sha512-OPs5WnnT1xkCBiuQrZA4+YAV4HEJejmHneyraIaxsbev5yCEr6KMwINNFP9wQeFIw8FWcoTqF3vQsa5CDaI+8Q==", "integrity": "sha512-LUhvPmAKAbgm+p/K11IWszLZVoZDlMF4NRmqbhEzDz/CnCuehPkZXwZbBCKGJsgjnuVejotBwM7B3Scrq4EqDw==",
"dev": true "dev": true
}, },
"node_modules/@types/tar-fs": { "node_modules/@types/tar-fs": {

View File

@ -43,7 +43,7 @@
"@tsconfig/node16": "^1.0.3", "@tsconfig/node16": "^1.0.3",
"@tsconfig/strictest": "^2.0.1", "@tsconfig/strictest": "^2.0.1",
"@types/follow-redirects": "^1.14.1", "@types/follow-redirects": "^1.14.1",
"@types/node": "^18.16.3", "@types/node": "^18.16.4",
"@types/tar-fs": "^2.0.1", "@types/tar-fs": "^2.0.1",
"clean-modules": "^2.0.6", "clean-modules": "^2.0.6",
"typescript": "^5.0.4" "typescript": "^5.0.4"

View File

@ -19,7 +19,9 @@ export const isValidUrl = (input: string) => {
/** /**
* Determines if the running instance is inside an AWS Lambda container. * Determines if the running instance is inside an AWS Lambda container.
* @returns * AWS_EXECUTION_ENV is for native Lambda instances
* AWS_LAMBDA_JS_RUNTIME is for netlify instances
* @returns boolean indicating if the running instance is inside a Lambda container
*/ */
export const isRunningInAwsLambda = () => { export const isRunningInAwsLambda = () => {
if ( if (
@ -27,6 +29,11 @@ export const isRunningInAwsLambda = () => {
/^AWS_Lambda_nodejs/.test(process.env["AWS_EXECUTION_ENV"]) === true /^AWS_Lambda_nodejs/.test(process.env["AWS_EXECUTION_ENV"]) === true
) { ) {
return true; return true;
} else if (
process.env["AWS_LAMBDA_JS_RUNTIME"] &&
/^nodejs/.test(process.env["AWS_LAMBDA_JS_RUNTIME"]) === true
) {
return true;
} }
return false; return false;
}; };