Skip to content

Commit

Permalink
Merge pull request #98 from Sparticuz/fix/netlify
Browse files Browse the repository at this point in the history
  • Loading branch information
Sparticuz authored May 5, 2023
2 parents b1810b4 + 3b51330 commit b21fdac
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"@tsconfig/node16": "^1.0.3",
"@tsconfig/strictest": "^2.0.1",
"@types/follow-redirects": "^1.14.1",
"@types/node": "^18.16.3",
"@types/node": "^18.16.4",
"@types/tar-fs": "^2.0.1",
"clean-modules": "^2.0.6",
"typescript": "^5.0.4"
Expand Down
9 changes: 8 additions & 1 deletion source/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,21 @@ export const isValidUrl = (input: string) => {

/**
* 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 = () => {
if (
process.env["AWS_EXECUTION_ENV"] &&
/^AWS_Lambda_nodejs/.test(process.env["AWS_EXECUTION_ENV"]) === true
) {
return true;
} else if (
process.env["AWS_LAMBDA_JS_RUNTIME"] &&
/^nodejs/.test(process.env["AWS_LAMBDA_JS_RUNTIME"]) === true
) {
return true;
}
return false;
};
Expand Down

0 comments on commit b21fdac

Please sign in to comment.