ubaniabalogun/serverless-package-python-functions

ENOENT: no such file or directory, open '_build/function_name'

sepulworld opened this issue · 6 comments

After updating to latest version of Serverless the packaging appears to be broken

example function config:

functions:
  set_office_hours:
    name: set_office_hours
    handler: set_office_hours.set_office_hours
    package:
      include:
        - set_office_hours
      artifact: ${self:custom.pkgPyFuncs.buildDir}/set_office_hours.zip

I confirm the _build/set_office_hours is there with content, however, no .zip

$ serverless deploy
Serverless: [serverless-package-python-functions] Packaging set_office_hours
Serverless: [serverless-package-python-functions] Packaging get_office_hours
Serverless: [serverless-package-python-functions] Packaging add_discussion_topic
Serverless: [serverless-package-python-functions] Packaging lookup_discussion_topics
Serverless: Packaging service...

  Error --------------------------------------------------

  ENOENT: no such file or directory, open '_build/set_office_hours.zip'

     For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.

  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Forums:        forum.serverless.com
     Chat:          gitter.im/serverless/serverless

  Your Environment Information -----------------------------
     OS:                     darwin
     Node Version:           8.2.1
     Serverless Version:     1.19.0

Im using the lastest you have here: https://www.npmjs.com/package/serverless-package-python-functions

Looks like maybe the zip-dir changes might be the source of the issue?

Hey @sepulworld.
This is interesting. I specifically changed from zip-dir to the new library because I ran into the issue you're experiencing now.
Can you please confirm you are using version 0.2.2 of the plugin?
Also, can you please share your custom.pkgPyFuncs configuration?

Ah, I was apparently using an older version. I updated to 0.2.2 but get a new error....

here is my custom.pkgPyFuncs config:

custom:
  pkgPyFuncs: # plugin configuration
    buildDir: _build
    requirementsFile: 'requirements.txt'

error I get now relates to the service name I am trying to package up.

Serverless: [serverless-package-python-functions] Packaging set_office_hours...
Serverless: [serverless-package-python-functions] Packaging get_office_hours...
Serverless: [serverless-package-python-functions] Packaging add_discussion_topic...
Serverless: [serverless-package-python-functions] Packaging lookup_discussion_topics...
Serverless: Packaging service...

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

  No oh-bot.zip file found in the package path you provided.

  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Forums:        forum.serverless.com
     Chat:          gitter.im/serverless/serverless

  Your Environment Information -----------------------------
     OS:                     darwin
     Node Version:           8.2.1
     Serverless Version:     1.19.0

It appears functions have their .zip's in _build but errors out at the next step it appears. It is looking for the file in .serverless but it doesn't exist.

Here is my app... any thoughts are appreciated!

https://github.com/silvermullet/oh-bot/blob/master/serverless.yml

I followed the workaround ...

$ touch .serverless/oh-bot.zip

and that seems to have fixed it.

@sepulworld.
I've seen this new error crop up before when the package individually option was not set to true. You'll need to set it as below in your serverless.yml

service: oh-bot

package: 
 individually: true 

# rest of serverless.yml

Thanks! Good looking out!