serverless: Openwhisk sequence actions cannot be deployed

Openwhisk supports so-called sequence actions, where a sequence only defines a chain of actions. The check recently introduced in https://github.com/serverless/serverless/pull/3729 prevents Openwhisk sequences to be deployed because by definition, a sequence does not have any code, so when packaged individually, the deployment of a sequence fails.

cc: @alexcasalboni and @pmuens, and also @jthomas for serverless-openwhisk

For bug reports:

  • What went wrong? Deployment failed.
  • What did you expect should have happened? Deployment should have succeeded.
  • What was the config you used?
service: test

# We package each function in a separate zip
package:
  individually: true
  exclude:
    - ./**

provider:
  name: openwhisk
  runtime: nodejs:default
  ignore_certs: true

plugins:
  - serverless-openwhisk

functions:

  action1:
    handler: src/action1/index.main
    package:
      include:
        - src/action1/**

  action2:
    handler: src/action2/index.main
    package:
      include:
        - src/action2/**
        
  actionSequence:
    sequence:
      - action1
      - action2
  • What stacktrace or error message from your provider did you see?
Serverless: Packaging service...

  Serverless Error ---------------------------------------

  No file matches include / exclude patterns

  Stack Trace --------------------------------------------

ServerlessError: No file matches include / exclude patterns
    at Package.zipDirectory (/usr/local/lib/node_modules/serverless/lib/plugins/package/lib/zipService.js:45:21)
    at Package.packageFunction (/usr/local/lib/node_modules/serverless/lib/plugins/package/lib/packageService.js:77:17)
    at _.map.functionName (/usr/local/lib/node_modules/serverless/lib/plugins/package/lib/packageService.js:39:21)
    at arrayMap (/usr/local/lib/node_modules/serverless/node_modules/lodash/lodash.js:660:23)
    at Function.map (/usr/local/lib/node_modules/serverless/node_modules/lodash/lodash.js:9571:14)
    at Package.packageService (/usr/local/lib/node_modules/serverless/lib/plugins/package/lib/packageService.js:34:31)
From previous event:
    at Object.package:createDeploymentArtifacts [as hook] (/usr/local/lib/node_modules/serverless/lib/plugins/package/package.js:62:10)
    at BbPromise.reduce (/usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:254:55)
From previous event:
    at PluginManager.invoke (/usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:254:22)
    at PluginManager.spawn (/usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:266:17)
    at Deploy.BbPromise.bind.then (/usr/local/lib/node_modules/serverless/lib/plugins/deploy/deploy.js:88:48)
From previous event:
    at Object.before:deploy:deploy [as hook] (/usr/local/lib/node_modules/serverless/lib/plugins/deploy/deploy.js:86:8)
    at BbPromise.reduce (/usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:254:55)
From previous event:
    at PluginManager.invoke (/usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:254:22)
    at PluginManager.run (/usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:273:17)
    at variables.populateService.then (/usr/local/lib/node_modules/serverless/lib/Serverless.js:105:33)
    at runCallback (timers.js:666:20)
    at tryOnImmediate (timers.js:639:5)
    at processImmediate [as _immediateCallback] (timers.js:611:5)
From previous event:
    at Serverless.run (/usr/local/lib/node_modules/serverless/lib/Serverless.js:92:74)
    at serverless.init.then (/usr/local/lib/node_modules/serverless/bin/serverless:30:50)

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 15 (11 by maintainers)

Most upvoted comments

Hello 👋.

Thanks for the investigation on this @cjelger, another user also reported this recently and I have an open ticket to look into this: https://github.com/serverless/serverless-openwhisk/issues/62

I agree with @pmuens that this should be fixed in the provider plugin. I will dig into the provider code soon and work out if this can be fixed without any upstream changes.

Looking at the serverless code and the openwhisk plugin, I don’t think there’s a nice way to fix this without an upstream change.

My solution would be this change, which is close to what @cjelger suggested. https://github.com/serverless/serverless/compare/master...jthomas:master

Functions would now support the following option.

functions:
  hello_world:
    package:
      ignore: true

These functions would not trigger the packageFunction call or set the packageService flag to true.

I’ve used the ignore flag as I think there might be future scenarios where providers want the ability to stop packaging from the framework. It should be less vendor specific than seq.

If we support this change, I will modify the openwhisk provider plugin to automatically add this flag to all sequence functions using a pre-process hook.

Without this upstream modification, I will have to try and monkey patch code in the framework or manually remove the functions from memory before the packaging plugin is ran and restate them afterwards. Neither of these feels as sensible as the change outlined above.

@pmuens @alexcasalboni what do you think? I can open the PR if you agree with this.

I would prefer disable as option name, as it effectively disables packaging of the particular function. Imo packaging cannot be ‘ignored’ - sounds strange.

I did a quick fix here, does it make sense to you?

Agreed! If no package is needed we should just NOT invoke the zipService.