openwhisk-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Thomas <jthomas...@gmail.com>
Subject Re: OpenWhisk NodeJS 8 support
Date Tue, 21 Nov 2017 10:34:58 GMT
This is awesome! Great work everyone.

Is there a *rough* timeline for when this version will be the default
Node.js runtime?

On 20 November 2017 at 20:06, Carlos Santana <csantana23@gmail.com> wrote:
> Dear OpenWhiskers
>
> We merged the PR [1] to add the nodejs 8 runtime in the default deployment
> configuration.
>
> This allows you now to specify the kind nodejs:8 [2]
>
> Node.js 6 already has good support for ES2015, Node.js 8 added a few more
> like async/await part of the ES2017 spec. You can now use async in the main
> function of the Action, I guess any function :-)
>
> This add a 3rd programing style in addition of callbacks and promises like
> this:
>
> const { promisify } = require('util');
> const request = promisify(require('request'));
>
> async function main({
>   location='San Juan',
>   url=`https://query.yahooapis.com/v1/public/yql?q=select item.condition
> from weather.forecast where woeid in (select woeid from geo.places(1) where
> text="'${location}'")&format=json`
> }){
>   let response
>   try {
>     response = await request(url)
>   } catch (err) {
>     console.error('Http error', err)
>     return Promise.reject({Error:err});
>   }
>   return JSON.parse(response.body).query.results.channel.item.condition;
> }
>
>
> For now, the default the nodejs kind is set to nodejs:6, the same for
> pre-warm containers on initialization of invoker.
>
> The nodejs 8 runtime only includes pre-installed the openwhisk sdk
>
> I added a webpack section [3] to the docs to illustrate how to add npm
> dependencies to their actions, in addition of using a zip archive.
>
> Also want to note that the breakdown of the runtimes into separate repos
> was a building block for my team to deliver in the downstream IBM Cloud
> Functions nodejs 8 support, the runtime in IBM includes some pre-installed
> latest npm packages for IBM services such as db2, s3 Object Storage,
> Watson, Cloudant and others similar set as node:js6 [4]
>
> Here is a good post from the Node.js team back when they introduced version
> 8 as current [5]
>
> [1] https://github.com/apache/incubator-openwhisk/pull/2958
> [2]
> https://github.com/apache/incubator-openwhisk/blob/master/docs/reference.md#nodejs-version-8-environment
> [3]
> https://github.com/apache/incubator-openwhisk/blob/master/docs/actions.md#package-an-action-as-a-single-bundle
> [4]
> https://console.bluemix.net/docs/openwhisk/openwhisk_reference.html##openwhisk_ref_javascript_environments_8
> [5] https://nodejs.org/en/blog/release/v8.0.0/
>
>
> Carlos
>
> On Tue, Nov 7, 2017 at 11:27 AM Carlos Santana <csantana23@gmail.com> wrote:
>
>> Hi
>>   I started looking into nodejs 8 support
>>
>> Something cool about nodejs8 it allows native support for async and wait,
>> and the new promisify
>> here is some good read on this:
>> http://2ality.com/2017/05/util-promisify.html
>>
>> I have a WIP PR with the support here
>> https://github.com/apache/incubator-openwhisk-runtime-nodejs/pull/5
>>
>> There are few things I want to see if we can improve and take the chance
>> to it since this will be a new kind. I added a list in the PR
>>
>> I have no issue opened because the repo is not enable with Issues, that's
>> why I put the details in the PR
>>
>> -- Carlos
>>
>>



-- 
Regards,
James Thomas

Mime
View raw message