New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support two new runtimes: nodejs8 and python37 #119

Closed
jubobs opened this Issue Aug 23, 2018 · 6 comments

Comments

Projects
None yet
5 participants
@jubobs
Copy link

jubobs commented Aug 23, 2018

This is a Feature Proposal

Add support for new runtimes nodejs8 and python37.

Description

Google recently announced support for two more runtimes (nodejs8 and python37), in addition to nodejs. The Serverless framework should support those two additional runtimes as well.

Support for the Python runtime is particularly desirable to those who are no fans of Node.js.

@jubobs jubobs changed the title Support two new runtimes: `nodejs8` and `python37` Support two new runtimes: nodejs8 and python37 Aug 23, 2018

@jubobs jubobs changed the title Support two new runtimes: nodejs8 and python37 Support new Python runtime Aug 23, 2018

@jubobs jubobs changed the title Support new Python runtime Support two new runtimes: nodejs8 and python37 Aug 23, 2018

@pestrov

This comment has been minimized.

Copy link

pestrov commented Aug 24, 2018

Are there any clues to how we could help to make a pull request on this issue? I would be able, provided the core team could elaborate on what to focus on.

@henry74

This comment has been minimized.

Copy link

henry74 commented Sep 16, 2018

Pull the latest serverless release 1.30.x - they added nodejs8 support

@Benoss

This comment has been minimized.

Copy link

Benoss commented Sep 18, 2018

What about python 3.7 ?

@pickypg

This comment has been minimized.

Copy link
Contributor

pickypg commented Oct 23, 2018

https://github.com/serverless/serverless-google-cloudfunctions/pull/114/files#diff-27d6eb1652c0c3d836eed4df04585a51R41

I'm pretty sure this PR being merged silently enables any runtime, even though its goal was to enable nodejs8 (by default!).

@jubobs

This comment has been minimized.

Copy link
Author

jubobs commented Nov 7, 2018

I can confirm that nodejs8 support is in place, though still undocumented. Here is a MWE:

index.js

exports.hello = (req, res) => {
  let message = req.query.message || req.body.message || 'Hello World!';
  res.status(200).send(message);
};

package.json

{
  "name": "sample-http",
  "version": "0.0.1",
  "dependencies": {
    "serverless": "^1.32.0",
    "serverless-google-cloudfunctions": "^2.2.0"
  }
}

serverless.yaml

service: my-service

provider:
  name: google
  runtime: nodejs8
  project: my-project
  credentials: ~/.gcloud/keyfile.json
  region: us-central1

plugins:
  - serverless-google-cloudfunctions

package:
  exclude:
    - node_modules/**
    - .gitignore
    - .git/**

functions:
  first:
    handler: hello
    events:
      - http: path
@jubobs

This comment has been minimized.

Copy link
Author

jubobs commented Nov 7, 2018

I can also confirm that python37 support is in place, though also still undocumented. Here is a MWE:

main.py

def hello(request):
    """Responds to any HTTP request.
    Args:
        request (flask.Request): HTTP request object.
    Returns:
        The response text or any set of values that can be turned into a
        Response object using
        `make_response <http://flask.pocoo.org/docs/0.12/api/#flask.Flask.make_response>`.
    """
    request_json = request.get_json()
    if request.args and 'message' in request.args:
        return request.args.get('message')
    elif request_json and 'message' in request_json:
        return request_json['message']
    else:
        return f'Hello World!'

serverless.yaml

service: my-service

provider:
  name: google
  runtime: python37
  project: my-project
  credentials: ~/.gcloud/keyfile.json
  region: us-central1

plugins:
  - serverless-google-cloudfunctions

package:
  exclude:
    - node_modules/**
    - .gitignore
    - .git/**

functions:
  first:
    handler: hello
    events:
      - http: path

@jubobs jubobs closed this Nov 7, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment