serverless / serverless-kubeless

This plugin enables support for Kubeless within the Serverless Framework.
Apache License 2.0
303 stars 81 forks source link

The "path" argument must be one of type string, Buffer, or URL. Received type undefined #150

Closed leonardoesx closed 6 years ago

leonardoesx commented 6 years ago

I'm trying to deploy a java serverless function. In my serverless.yml my package is being defined like this:

 package:
  artifact: target/api-fatura-1.0.2.jar

When I run sls deploy I get the following error:

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be one of type string, Buffer, or URL. Received type undefined
    at Object.statSync (fs.js:820:3)
    at KubelessDeploy.checkSize (/home/leonardo/work/esx/canais/api-fatura/node_modules/serverless-kubeless/deploy/kubelessDeploy.js:68:21)
    at _.each (/home/leonardo/work/esx/canais/api-fatura/node_modules/serverless-kubeless/deploy/kubelessDeploy.js:93:16)
    at /home/leonardo/work/esx/canais/api-fatura/node_modules/lodash/lodash.js:4911:15
    at baseForOwn (/home/leonardo/work/esx/canais/api-fatura/node_modules/lodash/lodash.js:2996:24)
    at /home/leonardo/work/esx/canais/api-fatura/node_modules/lodash/lodash.js:4880:18
    at Function.forEach (/home/leonardo/work/esx/canais/api-fatura/node_modules/lodash/lodash.js:9344:14)
    at kubelessConfig.init.then (/home/leonardo/work/esx/canais/api-fatura/node_modules/serverless-kubeless/deploy/kubelessDeploy.js:87:11)
    at process._tickCallback (internal/process/next_tick.js:68:7)

Digging into the code, I saw you guys are never trying to get

this.serverless.service.package.artifact

Which is, exactly, the property I need. Is it possible to include this line in kubelessDeloy.js ?

andresmgot commented 6 years ago

I can reproduce the issue, I will send a PR for fixing that.

Apart from that, note that the artifact should be a zip file containing the function, in your case you should include api-fatura-1.0.2.jar inside a zip file. Also note that you need to use the jvm runtime for using jar files.

andresmgot commented 6 years ago

We have released 0.5.1, that version should solve your issue :)