Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const handler = extractHandlerObject(
this.functionsFromServerlessConfig,
this.selectedFunctionFromCommandLine
);
this.serverless.cli.log(
`Server configured in single function mode.Requests will resolve via: ${
handler.file
}: ${handler.exportedFunction}`
);
this.proxy = BSTProxy.lambda(handler.file, handler.exportedFunction);
} else {
this.serverless.cli.log(
"Server configured with passthru routing. Url of requests will be interpreted as serverless handler specifications and dispatched to lambda function based on filesystem path."
);
// run local server in 'directory mode' -- requests are dispatched to appropriate lambda by mapping url to filesystem path
this.proxy = BSTProxy.lambda();
}
// enable secure mode if enabled
if (this.enableSecurity) {
this.proxy.activateSecurity();
}
// start the lambda proxy
this.proxy.start(async () => {
// HACK: reach into proxy and grab the moduleManager instance
const moduleManager = (this.proxy as any).lambdaServer
.moduleManager as ModuleManager;
// stop watching with watcher that uses node's fs.watch and use chokidar instead to allow for recursive symlink traversal
(moduleManager as any).watcher.close();
);
// create the lambda proxy
if (this.withPassThruRoutingOption == null) {
// run local server in 'single function mode' -- all requests are dispatched to a single lambda specified either on command line or
// by choosing first function from serverless config ...
const handler = extractHandlerObject(
this.functionsFromServerlessConfig,
this.selectedFunctionFromCommandLine
);
this.serverless.cli.log(
`Server configured in single function mode.Requests will resolve via: ${
handler.file
}: ${handler.exportedFunction}`
);
this.proxy = BSTProxy.lambda(handler.file, handler.exportedFunction);
} else {
this.serverless.cli.log(
"Server configured with passthru routing. Url of requests will be interpreted as serverless handler specifications and dispatched to lambda function based on filesystem path."
);
// run local server in 'directory mode' -- requests are dispatched to appropriate lambda by mapping url to filesystem path
this.proxy = BSTProxy.lambda();
}
// enable secure mode if enabled
if (this.enableSecurity) {
this.proxy.activateSecurity();
}
// start the lambda proxy
this.proxy.start(async () => {
// HACK: reach into proxy and grab the moduleManager instance