From 1b84efe98454a19c77f8c34f847b6866af27ea59 Mon Sep 17 00:00:00 2001 From: Sparticuz Date: Thu, 16 Nov 2023 12:38:19 -0500 Subject: [PATCH] change to use AWS_LAMBDA_JS_RUNTIME --- source/helper.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/helper.ts b/source/helper.ts index 1bad909..76dc716 100644 --- a/source/helper.ts +++ b/source/helper.ts @@ -4,7 +4,6 @@ import { tmpdir } from "node:os"; import { extract } from "tar-fs"; import { parse } from "node:url"; import type { UrlWithStringQuery } from "node:url"; -import { version } from "node:process"; interface FollowRedirOptions extends UrlWithStringQuery { maxBodyLength: number; @@ -40,7 +39,10 @@ export const isRunningInAwsLambda = () => { }; export const isRunningInAwsLambdaNode20 = () => { - if (version.startsWith("v20")) { + if ( + process.env["AWS_LAMBDA_JS_RUNTIME"] && + /^nodejs20.x/.test(process.env["AWS_LAMBDA_JS_RUNTIME"]) === true + ) { return true; } return false;