serverless / serverless-openwhisk

Adds Apache OpenWhisk support to the Serverless Framework!
http://openwhisk.org/
MIT License
143 stars 46 forks source link

Support for Python 3 broken for deploying to IBM Functions #127

Closed pbadeer closed 6 years ago

pbadeer commented 6 years ago

If I use

provider:
  name: openwhisk
  runtime: python3

I get

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

  Failed to deploy function (xxxxxxx) due to error: PUT https://openwhisk.ng.bluemix.net/api/v1/namespaces/_/actions/xxxxxxxx?overwrite=true Returned HTTP 400 (Bad Request) --> "The request content was malformed:
kind 'python3' not in Set(php:7.1, swift:4.1, nodejs:8, swift:3, nodejs, blackbox, java, python-jessie:3, sequence, nodejs:6, python:3, python, python:2, swift, swift:3.1.1)"

If I use runtime: python:3 or runtime: 'python:3' I get

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

  spawnSync python:3 ENOENT

If I use runtime: python3.6 I get

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

  Failed to deploy function (sls-flask-dev-app) due to error: PUT https://openwhisk.ng.bluemix.net/api/v1/namespaces/_/actions/sls-flask-dev-app?overwrite=true Returned HTTP 400 (Bad Request) --> "The request content was malformed:
kind 'python3.6' not in Set(php:7.1, swift:4.1, nodejs:8, swift:3, nodejs, blackbox, java, python-jessie:3, sequence, nodejs:6, python:3, python, python:2, swift, swift:3.1.1)"

Am I doing something wrong? I'm assuming this problem is caused by IBM Function's new format for Python 3 deployments, which requires a --kind python:3 flag in the deploy command.

jthomas commented 6 years ago

Thanks for reporting this. I'll have a look and get back to you...

jthomas commented 6 years ago

The correct method to specify the Python 3 runtime is the second approach you suggest.

service: pythontest
provider:
  name: openwhisk
  runtime: python:3

functions:
  hello:
    handler: handler.hello

plugins:
  - serverless-openwhisk

I have just tested this with the project from the openwhisk-python template and have deployed it to IBM Cloud Functions in US-South.

Could you post the serverless.yaml file in here and output from the deploy command with verbose logging output?

$ SLS_DEBUG='*' sls deploy

pbadeer commented 6 years ago

I believe my Python environment was causing issues, I cleaned everything out and started over using that same template you used and it worked just fine.

Thank you!

jthomas commented 6 years ago

Hurrah - I love issues that resolve themselves :)