Skip to content
This repository was archived by the owner on Dec 9, 2024. It is now read-only.
This repository was archived by the owner on Dec 9, 2024. It is now read-only.

Opt in to use locally installed Azure Functions Core Tools, instead of node_modules/.bin tools. #667

@BartInTheField

Description

@BartInTheField

This is a Feature Proposal

Description

Right now in the utils used for sls offline, node_modules/.bin of the serverless instance it self are used to spawn azure functions. As a user I would like to opt in to use self installed Azure Functions Core Tools, in practice this means just running func.

Why?

In the case of using a monorepo like NX or Lerna, node_modules are stored in the root of a project. The current implementation searches for azure functions tools in a path that does not exist in these monorepo's.

Also, when the user has worked previously with Azure Functions Core Tools or also uses Azure functions outside of serverless, it would be beneficial to used there own locally installed tools.

How?

I have written my own patch to support this behaviour. But it would be better to have some command line arguments to opt in to this behaviour without writing a patch.

--- a/node_modules/serverless-azure-functions/lib/shared/utils.js
+++ b/node_modules/serverless-azure-functions/lib/shared/utils.js
@@ -282,8 +282,7 @@ var Utils = /** @class */ (function () {
      */
     Utils.spawnLocal = function (options) {
         var serverless = options.serverless, command = options.command;
-        var localCommand = path_1.join(serverless.config.servicePath, "node_modules", ".bin", command);
-        return this.spawn(__assign({}, options, { command: localCommand, commandName: command }));
+        return this.spawn(__assign({}, options, { commandName: command }));
     };
     // public static spawn()
     Utils.spawn = function (options) {

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions