Hi Admin, Greetings of the day.
I have found my lambda function and got the code and i debugged the place and finally i found the place where that actual error is occur.
Code given below for more clarity:
var require_resolve2 = __commonJS({
"node_modules/app-root-path/lib/resolve.js"(exports2, module2) {
"use strict";
var path2 = require("path");
var globalPaths = require("module").globalPaths;
var npmGlobalPrefix;
if ("win32" === process.platform) {
npmGlobalPrefix = path2.dirname(process.execPath);
} else {
npmGlobalPrefix = path2.dirname(path2.dirname(process.execPath));
}
var npmGlobalModuleDir = path2.resolve(npmGlobalPrefix, "lib", "node_modules");
var sep = path2.sep;
module2.exports = function resolve(dirname) {
if (process.env.APP_ROOT_PATH) {
return path2.resolve(process.env.APP_ROOT_PATH);
}
if ("undefined" !== typeof window && window.process && "renderer" === window.process.type) {
var electron = "electron";
var remote = require(electron).remote;
return remote.require("app-root-path").path;
}
var resolved = path2.resolve(dirname);
var alternateMethod = false;
var appRootPath = null;
globalPaths.forEach(function(globalPath) {
if (!alternateMethod && 0 === resolved.indexOf(globalPath)) {
alternateMethod = true;
}
});
var nodeModulesDir = sep + "node_modules";
if (!alternateMethod && -1 !== resolved.indexOf(nodeModulesDir)) {
var parts = resolved.split(nodeModulesDir);
if (parts.length) {
appRootPath = parts[0];
parts = null;
}
}
if (alternateMethod || null == appRootPath) {
appRootPath = path2.dirname(require.main.filename);
}
if (alternateMethod && -1 !== appRootPath.indexOf(npmGlobalModuleDir) && appRootPath.length - 4 === appRootPath.indexOf(sep + "bin")) {
appRootPath = appRootPath.slice(0, -4);
}
return appRootPath;
};
}
});
In above code i have highlighted the part where that error occour.
Why that path2.dirname(require.main.filename) la filename property is undefined.
Help to get the root cause for this. Im not sure is this directory permission on AWS lambda. If anything like directory changes kindly let me know i will update my User permissions acccordingly.
Waiting for your message .
Folks If you have any insights please feel free to share. Thanks in Advance