Skip to content
This repository has been archived by the owner on Jul 10, 2023. It is now read-only.

Commit

Permalink
add version check before making module path as relative path
Browse files Browse the repository at this point in the history
  • Loading branch information
fatihaydilek committed Aug 18, 2020
1 parent 56622ba commit 3b72981
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/wrappers/lambda/lambdaRuntimeSupport.ts
Expand Up @@ -6,6 +6,7 @@

const path = require('path');
const fs = require('fs');
const semver = require('semver');

class InvalidModule extends Error {}
class InvalidHandler extends Error {}
Expand Down Expand Up @@ -42,9 +43,11 @@ export function loadHandler(appPath: string, handlerString: string) {

const handlerPath = match[2];
let module = match[1];
if (module && !(module.startsWith('./') ||
module.startsWith('../'))) {
module = './' + module;
if (semver.satisfies(process.version, '12.x')) {
if (module && !(module.startsWith('./') ||
module.startsWith('../'))) {
module = './' + module;
}
}

let userModule;
Expand Down

0 comments on commit 3b72981

Please sign in to comment.