profile
viewpoint
Lance Ball lance Red Hat (@nodeshift) Asheville, NC https://lanceball.dev He writes software, cooks food, exercises, takes pictures, grows things. Red Hat.

keycloak/keycloak-admin-client 45

Replaced by https://github.com/keycloak/keycloak-nodejs-admin-client

bucharest-gold/genet 9

Node.js profiling tool

keycloak/keycloak-client-registration 7

Node.js client for the Keycloak client registration API

lance/acts_as_keyable 4

Uses Rails routing to make nice URLs so you get /books/oliver_twist instead of /books/1234

lance/admin_data 1

Browse and Manage your data using browser

lance/awestruct.org 1

awestruct.org website

push eventlance/node-ce-functions

Lance Ball

commit sha f8a9cad9aeb7b9146384fce5b5558715f207eec1

templates: add a README and local execution for default (#4) The default function template should run locally without requiring container execution. This change adds a `local.js` file to the template and a script in `package.json` in order to enable that. Additionally, I added a README to the template to help users getting started.

view details

push time in 2 days

push eventopenshift-cloud-functions/node-ce-functions

Lance Ball

commit sha f8a9cad9aeb7b9146384fce5b5558715f207eec1

templates: add a README and local execution for default (#4) The default function template should run locally without requiring container execution. This change adds a `local.js` file to the template and a script in `package.json` in order to enable that. Additionally, I added a README to the template to help users getting started.

view details

push time in 2 days

PR merged openshift-cloud-functions/node-ce-functions

Reviewers
templates: add a README and local execution for default

The default function template should run locally without requiring container execution. This change adds a local.js file to the template and a script in package.json in order to enable that. Additionally, I added a README to the template to help users getting started.

+86 -1

0 comment

3 changed files

lance

pr closed time in 2 days

push eventopenshift-cloud-functions/quarkus-ce-functions

Matej Vasek

commit sha 6dd439055b5e4a8ee1f3b7f112db872fcbbc29df

image: change local run/test to mount only src, pom.xml and mvnw By making this change, developers who have a local user ID other than 1000 can successfully run and test applications locally. This is because, prior to this change the entire `/project/user-app` directory was mounted from localhost. If the local user did not have a 1000 userid, there would be permission errors writing to the mounted host. This change allows the container to own everything except the source folder, pom.xml and mvnw.

view details

push time in 3 days

PR merged openshift-cloud-functions/quarkus-ce-functions

Reviewers
fixed mounts

this fixes permission denied errors

+2 -2

1 comment

1 changed file

matejvasek

pr closed time in 3 days

PR opened openshift-cloud-functions/node-ce-functions

Reviewers
templates: add a README and local execution for default

The default function template should run locally without requiring container execution. This change adds a local.js file to the template and a script in package.json in order to enable that. Additionally, I added a README to the template to help users getting started.

+86 -1

0 comment

3 changed files

pr created time in 3 days

push eventlance/node-ce-functions

Lance Ball

commit sha 3a1c9bfa5be49a10ef2adda7c486afe4862d8d06

template,test: make template function async and ensure it works (#3)

view details

Lance Ball

commit sha 9d3cb5dc2ce0b03d5bc51b1b798d9f111da92706

templates: add a README and local execution for default The default function template should run locally without requiring container execution. This change adds a `local.js` file to the template and a script in `package.json` in order to enable that. Additionally, I added a README to the template to help users getting started.

view details

push time in 3 days

push eventlance/node-ce-functions

Lance Ball

commit sha 5db4e7724d3136bb8a6389d73a1b0976bff2e7cf

templates: add a README and local execution for default The default function template should run locally without requiring container execution. This change adds a `local.js` file to the template and a script in `package.json` in order to enable that. Additionally, I added a README to the template to help users getting started.

view details

push time in 3 days

push eventopenshift-cloud-functions/node-ce-functions

Lance Ball

commit sha 3a1c9bfa5be49a10ef2adda7c486afe4862d8d06

template,test: make template function async and ensure it works (#3)

view details

push time in 3 days

PR merged openshift-cloud-functions/node-ce-functions

template,test: make template function async and ensure it works

This commit changes the template to export an async function.

+7 -6

0 comment

2 changed files

lance

pr closed time in 3 days

PR opened openshift-cloud-functions/node-ce-functions

Reviewers
template,test: make template function async and ensure it works

This commit changes the template to export an async function.

+7 -6

0 comment

2 changed files

pr created time in 3 days

push eventlance/node-ce-functions

Lance Ball

commit sha 4532e646ce0a115f733a8c2138c8394a0e290253

build,test,doc: add makefile, add integration test, update README (#2) Update template tests to include unit tests, invoking the function directly, and integration tests, invoking via a cloud event over HTTP. Instead of checking cloud event return values in the template tests, we can do that here in the integration test for the stack itself. The default template test simply confirms that a response was received. * Added a Makefile to make build/test simpler. * Bumped faas-js-runtime dependency to 0.2.0.

view details

Lance Ball

commit sha fe4291184f85a550c1e92f2042a136192805eedc

template,test: make template function async and ensure it works

view details

push time in 3 days

push eventlance/node-ce-functions

Lance Ball

commit sha 529d672fe2ebb3e7d0cb4230699eebd61c22d752

template: change template function to be async

view details

push time in 3 days

push eventopenshift-cloud-functions/quarkus-ce-functions

Lance Ball

commit sha 809a284f584f4fd0dda35c7b663543f1865c47f4

doc: update readme with dev.local help

view details

push time in 4 days

push eventopenshift-cloud-functions/quarkus-ce-functions

Lance Ball

commit sha 7b3d3a9185d7310d4da3caac4f7d61aae0da5975

image: add APPSODY_PROJECT_DIR and USER 1000

view details

push time in 5 days

Pull request review commentnodeshift/opossum

fix: circuit breaker global should be capital.

 function generateConfig (name) {   const config = {     mode,     entry: {-      circuitBreaker: './index.js'+      CircuitBreaker: './index.js'     },     output: {       path: path.resolve(__dirname, '..', 'dist'),       filename: `${name}.js`,       sourceMapFilename: `${name}.map`,-      library: 'circuitBreaker',+      library: 'CircuitBreaker',       libraryTarget: 'umd'     },     node: {       process: true,       console: true     },     plugins: [-      new webpack.IgnorePlugin(/prom-client/),       new webpack.ProvidePlugin({-        'circuitBreaker': 'opossum'+        'CircuitBreaker': 'opossum'

Fine with me.

lholmquist

comment created time in 5 days

fork lance/quarkus-ce-functions

Appsody stack for developing and deploying Quarkus functions on Knative

fork in 5 days

create barnchopenshift-cloud-functions/quarkus-ce-functions

branch : master

created branch time in 5 days

created repositoryopenshift-cloud-functions/quarkus-ce-functions

Appsody stack for developing and deploying Quarkus functions on Knative

created time in 5 days

create barnchlance/stacks

branch : quarkus-functions

created branch time in 8 days

push eventopenshift-cloud-functions/node-ce-functions

Lance Ball

commit sha 4532e646ce0a115f733a8c2138c8394a0e290253

build,test,doc: add makefile, add integration test, update README (#2) Update template tests to include unit tests, invoking the function directly, and integration tests, invoking via a cloud event over HTTP. Instead of checking cloud event return values in the template tests, we can do that here in the integration test for the stack itself. The default template test simply confirms that a response was received. * Added a Makefile to make build/test simpler. * Bumped faas-js-runtime dependency to 0.2.0.

view details

push time in 9 days

PR merged openshift-cloud-functions/node-ce-functions

build,test,doc: add makefile, add integration test, update README

Update template tests to include both unit tests, invoking the function directly, and integration tests - invoking via a cloud event over HTTP.

Added a Makefile to make build/test simpler.

Bumped faas-js-runtime dependency to 0.2.0.

+97 -44

1 comment

10 changed files

lance

pr closed time in 9 days

pull request commentopenshift-cloud-functions/node-ce-functions

build,test,doc: add makefile, add integration test, update README

@lkingland thanks for the review. I believe I've addressed your (good and valid) points.

lance

comment created time in 9 days

push eventlance/node-ce-functions

Lance Ball

commit sha 69eebc41a9d22036c30d74be71d1e4f519acd968

build,test,doc: add makefile, add integration test, update README Instead of checking cloud event return values in the template tests, we can do that here in the integration test for the stack itself. The default template test simply confirms that a response was received.

view details

push time in 9 days

Pull request review commentopenshift-cloud-functions/node-ce-functions

build,test,doc: add makefile, add integration test, update README

 'use strict'; -module.exports = function(context) {-  context.log.info(context);+module.exports = function (context) {+  if (!context.cloudevent) {

So, the faas-js-runtime framework can handle both raw HTTP and Cloud Events, but this stack - for now - is only meant for Cloud Events. We may choose to remove this check in the future, or expose another Node.js stack (although at the moment, appsody itself has a handful of plain old Node stacks already).

lance

comment created time in 9 days

Pull request review commentopenshift-cloud-functions/node-ce-functions

build,test,doc: add makefile, add integration test, update README

+'use strict';++const runtime = require('@redhat/faas-js-runtime');+const request = require('supertest');++const func = require('..');+const test = require('tape');+const cloudevents = require('cloudevents-sdk/v1');++const Spec = {+  version: 'ce-specversion',+  type: 'ce-type',+  id: 'ce-id',+  source: 'ce-source'+};++test('Handles a valid event', t => {+  runtime(func, server => {+    t.plan(2);+    request(server)+      .post('/')+      .send({ message: 'hello' })+      .set(Spec.id, 'TEST-EVENT-1')+      .set(Spec.source, 'http://localhost:8080/integration-test')+      .set(Spec.type, 'dev.faas.example')+      .set(Spec.version, '1.0')+      .expect(200)+      .expect('Content-Type', /json/)+      .end((err, res) => {+        t.error(err, 'No error');+        t.equal(res.body.data.message, 'hello');

Modified the test to not check return value, and moved that check to a stack image build test.

lance

comment created time in 9 days

push eventlance/node-ce-functions

Lance Ball

commit sha 519c6ad31e3f8594c5c4ffbefa072b95566f1808

squash: remove data value check in template test

view details

push time in 9 days

Pull request review commentopenshift-cloud-functions/node-ce-functions

build,test,doc: add makefile, add integration test, update README

 'use strict'; -module.exports = function(context) {-  context.log.info(context);+module.exports = function (context) {+  if (!context.cloudevent) {+    return new Error('No cloud event received');+  }+  context.log.info(`Cloud event received: ${context.cloudevent}`);+  return {+    data: context.cloudevent.data

This is a really good point that I hadn't considered. I've modified the template unit test to only check that there is no error, and added this integration test to the stack image itself for testing when building the stack.

lance

comment created time in 9 days

push eventlance/node-ce-functions

Lance Ball

commit sha 5006b63393b097e6b4cc18548f6a5492a25bf84e

test: add integration test to stack image Instead of checking cloud event return values in the template tests, we can do that here in the integration test for the stack itself. The default template test simply confirms that a response was received.

view details

push time in 9 days

push eventlance/node-ce-functions

Lance Ball

commit sha ffbf00446af879d6f50b0c393e752b1915a97635

squash: improved Makefile structure

view details

push time in 9 days

PR opened openshift-cloud-functions/node-ce-functions

build,test,doc: add makefile, add integration test, update README

Update template tests to include both unit tests, invoking the function directly, and integration tests - invoking via a cloud event over HTTP.

Added a Makefile to make build/test simpler.

Bumped faas-js-runtime dependency to 0.2.0.

+73 -11

0 comment

8 changed files

pr created time in 10 days

push eventlance/node-ce-functions

Lance Ball

commit sha 180176bbcfc6fecd6efab0676c14549d1ce26151

build,test,doc: add makefile, add integration test, update README

view details

push time in 10 days

push eventopenshift-cloud-functions/faas-js-runtime

Lance Ball

commit sha da3949913739a2ad8a450b22b440d7e7fb658869

src: minor linting

view details

push time in 10 days

fork lance/node-ce-functions

Appsody stack for deploying Node.js functions which respond to cloud events

fork in 10 days

created tagopenshift-cloud-functions/faas-js-runtime

tagv0.2.0

Node.js framework for executing a function that can respond to HTTP and cloud events

created time in 10 days

push eventopenshift-cloud-functions/faas-js-runtime

Lance Ball

commit sha aece65cf575d3a1a7b1815bfdb37506823d09842

chore(release): 0.2.0

view details

push time in 10 days

push eventlance/ce-functions

lkingland

commit sha 9945fc76a21c1967b60dcc8448a915aa5011aaa2

Node.js Stack Updates (#1) * specify language as JavaScript * default template 'default' * mount current directory as 'function' * move simple template to default * use 'function' for user-app * prettify and remove duplicate in tests * default template updates Print event to log by default to enable demo of updating to return. Check for an invalid context to facilitate test examples. * default package.json dependencies etc. * default template tests * set health and liveness endpoints * simply log the context on invocation * explicitly set run and debug kill to true

view details

push time in 10 days

PR merged lance/ce-functions

Node.js Stack Updates

Minor tweaks to the Node.js Appsody FaaS stack. Synopsis:

  1. Updated the maintainer to be myself.
  2. Naming changes to favor "JavaScript" and "Function" where applicable.
  3. Example test in the default project template based on Tape.
  4. Health and Liveness endpoints updated to match faas-js-runtime's settings.
+71 -65

4 comments

12 changed files

lkingland

pr closed time in 10 days

Pull request review commentlance/ce-functions

Node.js Stack Updates

-name: Node.js Cloud Events+name: JavaScript FaaS version: 0.0.1-description: Serverless Node.js function runtime for Cloud Events+description: Node.js Function Runtime license: Apache-2.0-language: nodejs+language: JavaScript maintainers:-  - name: Lance Ball-    email: lball@redhat.com-    github-id: lance

I didn't mean to imply that you shouldn't be there as well :)

lkingland

comment created time in 10 days

push eventopenshift-cloud-functions/faas-js-runtime

lkingland

commit sha 0bec8df02425719f0dc5ad974164bee8393d3a9e

feat: provide structured logger to functions in context (#28) * feat: provide structured logger to functions in context * src: add logger to context from request during construction * test: add tests for logger's existence whether enabled or not by the user

view details

push time in 10 days

PR merged openshift-cloud-functions/faas-js-runtime

feat: provide structured logger to functions in context

Provides the fastify server's structured logger to functions via the context.

+34 -1

2 comments

2 changed files

lkingland

pr closed time in 10 days

Pull request review commentlance/ce-functions

Node.js Stack Updates

-name: Node.js Cloud Events+name: JavaScript FaaS version: 0.0.1-description: Serverless Node.js function runtime for Cloud Events+description: Node.js Function Runtime license: Apache-2.0-language: nodejs+language: JavaScript maintainers:-  - name: Lance Ball-    email: lball@redhat.com-    github-id: lance

If you don't mind leaving me in as a maintainer, I'd appreciate it. :)

lkingland

comment created time in 11 days

Pull request review commentlance/ce-functions

Node.js Stack Updates

+'use strict';++const func = require('..');+const test = require('tape');+const cloudevents = require('cloudevents-sdk/v1');++// Ensure that the function completes cleanly when passed a valid event.+test('Handles a valid event', t => {+  // A valid event includes id, type and source at a minimum.+  let e = cloudevents.event();+  e.id('TEST-EVENT-01');+  e.type('com.example.cloudevents.test');+  e.source('http://localhost:8080/');

Eventually, it might be nice to provide some level of framework testing support so that it's easier for a function developer to inject events. This isn't bad though.

lkingland

comment created time in 11 days

Pull request review commentlance/ce-functions

Node.js Stack Updates

 FROM node:12  ENV APPSODY_PROJECT_DIR=/project-ENV APPSODY_MOUNTS=/:/project/user-app-ENV APPSODY_DEPS=/project/user-app/node_modules+ENV APPSODY_MOUNTS=.:/project/function+ENV APPSODY_DEPS=/project/function/node_modules -ENV APPSODY_WATCH_DIR=/project/user-app-ENV APPSODY_WATCH_IGNORE_DIR=/project/user-app/node_modules+ENV APPSODY_WATCH_DIR=/project/function+ENV APPSODY_WATCH_IGNORE_DIR=/project/function/node_modules ENV APPSODY_WATCH_REGEX="^.*.js$" +ENV APPSODY_TEST="npm test && npm test --prefix function"+ENV APPSODY_TEST_ON_CHANGE=""+ENV APPSODY_TEST_KILL=false+ ENV APPSODY_RUN="npm start"-ENV APPSODY_RUN_ON_CHANGE="npm start"-ENV APPSODY_RUN_KILL=true+ENV APPSODY_RUN_ON_CHANGE="$APPSODY_RUN"  ENV APPSODY_DEBUG="npm start --node-options --inspect=0.0.0.0"-ENV APPSODY_DEBUG_ON_CHANGE="npm start --node-options --inspect=0.0.0.0"-ENV APPSODY_DEBUG_KILL=true

Same question as above. It's not clear that removing these results in the same behavior.

lkingland

comment created time in 11 days

Pull request review commentlance/ce-functions

Node.js Stack Updates

 FROM node:12  ENV APPSODY_PROJECT_DIR=/project-ENV APPSODY_MOUNTS=/:/project/user-app-ENV APPSODY_DEPS=/project/user-app/node_modules+ENV APPSODY_MOUNTS=.:/project/function+ENV APPSODY_DEPS=/project/function/node_modules -ENV APPSODY_WATCH_DIR=/project/user-app-ENV APPSODY_WATCH_IGNORE_DIR=/project/user-app/node_modules+ENV APPSODY_WATCH_DIR=/project/function+ENV APPSODY_WATCH_IGNORE_DIR=/project/function/node_modules ENV APPSODY_WATCH_REGEX="^.*.js$" +ENV APPSODY_TEST="npm test && npm test --prefix function"+ENV APPSODY_TEST_ON_CHANGE=""+ENV APPSODY_TEST_KILL=false+ ENV APPSODY_RUN="npm start"-ENV APPSODY_RUN_ON_CHANGE="npm start"-ENV APPSODY_RUN_KILL=true

I've read the appsody docs, and it's not clear to me that removing these results in the same behavior. I think it's probably best to keep these explicit.

lkingland

comment created time in 11 days

push eventopenshift-cloud-functions/faas-js-runtime

Daniel Bevenius

commit sha fb0a97b347646e36389a5cf34fbe32e7c317ff39

src: add constants for cloudevent headers (#27) This commit adds constants for the HTTP headers that are used for cloud events.

view details

push time in 11 days

PR merged openshift-cloud-functions/faas-js-runtime

src: add constants for cloudevent headers

This commit adds constants for the HTTP headers that are used for cloud events.

+31 -19

0 comment

3 changed files

danbev

pr closed time in 11 days

Pull request review commentopenshift-cloud-functions/faas-js-runtime

src: add constants for cloudevent headers

 const v02 = require('cloudevents-sdk/v02'); const v03 = require('cloudevents-sdk/v03'); const v1 = require('cloudevents-sdk/v1');+const Spec = require('./ce-constants.js').Spec;

Nit: This would be more concise as

const { Spec } = require('./ce-constants.js');

But that's really minor.

danbev

comment created time in 15 days

CommitCommentEvent
CommitCommentEvent
CommitCommentEvent
CommitCommentEvent

push eventopenshift-cloud-functions/faas-js-runtime

Lucas Holmquist

commit sha 293e55747ed0ee92b0ea241a29946bab0fdb24ec

fix(README): update sample to use correct namespaced module (#26)

view details

push time in 17 days

push eventlance/ce-functions

Lance Ball

commit sha 44a1901cdf340d81dd7c8fbd5b65667a30d4d0df

test: add liveness URL test

view details

push time in 25 days

pull request commentnodeshift/opossum-hystrix

Remove global Transform stream

TY @lholmquist for the release and @mcollina for the contribution!

mcollina

comment created time in 25 days

push eventnodeshift/opossum-hystrix

Matteo Collina

commit sha aa9fa86693b4e21d6ce8f996ec8ef992229a2a64

Remove global Transform stream (#10) * Remove the shared transform stream to avoid EE leaks * Fix shutdown logic Fixes: https://github.com/nodeshift/opossum-hystrix/issues/9

view details

push time in a month

PR merged nodeshift/opossum-hystrix

Remove global Transform stream

This removes the global transform stream. From this PR onwards, it would be only accessible through directly from the HystricsMetrix object.

This is a breaking change as it will change the API, considering this is released as 0.0.1, I would recommend to bump to 0.1.0 or 1.0.0.

Fixes #9

+45 -27

0 comment

3 changed files

mcollina

pr closed time in a month

issue closednodeshift/opossum-hystrix

Avoid a global transform stream

I'm seeing some warnings about the number of listeners on EventEmitter if multiple instances of HystrixStats are created within the same application. These are caused by the global Transform stream in https://github.com/nodeshift/opossum-hystrix/blob/fa03ab0454ae8ab236976fd35352988d3fdec5a1/lib/hystrix-stats.js#L6-L12.

I would recommend to move this inside HystrixStats object itself, so that each instance of the stats object can be run inside the same Node.js process. This will change the example to:


const CircuitBreaker = require('opossum');
  const HystrixStats = require('opossum-hystrix');
  const express = require('express');

  const app = express();
  app.use('/hystrix.stream', hystrixStream);

  // create a couple of circuit breakers
  const c1 = new CircuitBreaker(someFunction);
  const c2 = new CircuitBreaker(someOtherfunction);

  // Provide them to the constructor
  const hystrixMetrics = new HystrixStats([c1, c2]);

  // Provide a Server Side Event stream of metrics data
  function hystrixStream (request, response) {
      response.writeHead(200, {
        'Content-Type': 'text/event-stream',
        'Cache-Control': 'no-cache',
        'Connection': 'keep-alive'
        });
      response.write('retry: 10000\n');
      response.write('event: connecttime\n');

      // Old: HystrixStats.stream.pipe(response);
      hystrixMetrics.stream.pipe(response);
    };
  }

I'm happy to send a PR

closed time in a month

mcollina

push eventnodeshift/opossum

Matt R. Wilson

commit sha 2453326b726312b075c062c361b6c7a6dcb4c0a8

fix(circuit): allow timeout option to be false (#396) * fix(circuit): allow timeout option to be false Allow `false` to be provided for the `timeout` option as a means of disabling the entire feature. Fixes #393. * test: timeout=false option

view details

push time in a month

PR merged nodeshift/opossum

Reviewers
fix(circuit): allow timeout option to be false needs-review

Allow false to be provided for the timeout option as a means of disabling the entire feature.

Note that the logic to skip the timeout feature if the option is falsey was still in place was did not need an update for this fix. https://github.com/nodeshift/opossum/blob/30a83b361fc0e61f111ff846709712e9c476c77d/lib/circuit.js#L495

I'm not sure a good way to test this beyond monkey-patching the global setTimeout and asserting it wasn't called. So I haven't added a test, but would be happy to add one if there is a preferred method.

Fixes #393.

+28 -2

3 comments

2 changed files

mastermatt

pr closed time in a month

issue closednodeshift/opossum

Lost ability to disable timeout.

The breaking changes that were released with v4.0 from https://github.com/nodeshift/opossum/pull/366 included the lose of ability to no longer specify timeout: false. It's unclear if this was intentional.

My primary use-case for Opossum is to wrap external HTTP calls, in those cases I'd prefer the HTTP client be in control of the timeout instead of Opossum. So currently, I have to hard code a silly-large number into the option.

The feature was originally added in https://github.com/nodeshift/opossum/pull/202. The feature was removed from the JSDocs here.

closed time in a month

mastermatt

push eventopenshift-cloud-functions/faas-js-runtime

Lance Ball

commit sha b24694827ff0de4ebbbf3977cd7ab9fbf6e14391

feat: add support for 1.0 structured cloud events (#24)

view details

push time in a month

PR merged openshift-cloud-functions/faas-js-runtime

Reviewers
feat: add support for 1.0 structured cloud events enhancement

Adds support for Cloud Events 1.0 in structured mode (even though knative doesn't support this yet, afaik). Structured mode is not supported for 0.2 or 0.3 cloud events for this implementation.

Fixes: https://github.com/openshift-cloud-functions/faas-js-runtime/issues/22

+64 -12

0 comment

3 changed files

lance

pr closed time in a month

issue closedopenshift-cloud-functions/faas-js-runtime

Add support for structured cloud events

https://github.com/cloudevents/spec/blob/v1.0/http-protocol-binding.md#32-structured-content-mode

closed time in a month

lance

delete branch lance/controller

delete branch : sh-for-shell

delete time in a month

Pull request review commentopenshift-cloud-functions/faas-js-runtime

src: remove unused 'context' property

 function start(func, port, cb, options) {   const server = fastify({ logger: log });    // All incoming requests get a Context object-  server.decorateRequest('context');   server.addHook('onRequest', (req, reply, done) => {     req.context = new Context(req, reply);

The two separate lines are how the Fastify docs recommend doing this. When you remove the call to decorateRequest, the onRequest hook still is invoked and the context property is still set. According to the docs, the decorateRequest call is optional, but allows Fastify to do a little performance optimization: https://www.fastify.io/docs/latest/Decorators/#usage-notes

danbev

comment created time in a month

Pull request review commentopenshift-cloud-functions/faas-js-runtime

src: remove unused 'context' property

 function start(func, port, cb, options) {   const server = fastify({ logger: log });    // All incoming requests get a Context object-  server.decorateRequest('context');   server.addHook('onRequest', (req, reply, done) => {     req.context = new Context(req, reply);

It's used right here! :)

And here: https://github.com/openshift-cloud-functions/faas-js-runtime/blob/master/lib/request-handler.js#L15-L20 And here: https://github.com/openshift-cloud-functions/faas-js-runtime/blob/master/lib/event-handler.js#L40-L46

The decorateRequest call ensures that there is a property called context on the request object within this scope, and line 32 here sets that to a new instance during the onRequest hook. The cloud event handler and the invoker both depend on this.

danbev

comment created time in a month

pull request commentnodeshift/opossum

fix(circuit): allow timeout option to be false

Codacy Here is an overview of what got changed by this pull request:


Complexity increasing per file
==============================
- lib/circuit.js  1
         

See the complete overview on Codacy

mastermatt

comment created time in a month

pull request commentnodeshift/opossum

fix(circuit): allow timeout option to be false

Codacy Here is an overview of what got changed by this pull request:


Complexity increasing per file
==============================
- lib/circuit.js  1
         

See the complete overview on Codacy

mastermatt

comment created time in a month

pull request commentnodeshift/opossum

fix(circuit): allow timeout option to be false

Codacy Here is an overview of what got changed by this pull request:


Complexity increasing per file
==============================
- lib/circuit.js  1
         

See the complete overview on Codacy

mastermatt

comment created time in a month

push eventnodeshift/opossum

Jair Elton Batista de Souza

commit sha a721f3f345f67cdf0917d75d637c4e8bfbce0e8e

bug: fix stuck halfOpen when using errorFilter (#389) * Fix stuck halfOpen when using errorFilter When an error is filtered by an errorFilter the request is considered neither success nor failure, leaving the circuit in an inconsistent state. This fixes that issue by emitting success event when the error is filtered. * Call fallback when an error is filtered When an error is filtered, it is considered a success, however we need a result to resolve with, this way, we should call fallback to get a valid result. If there is no fallback, we reject to give the application a chance to handle the error.

view details

push time in 2 months

PR merged nodeshift/opossum

Fix stuck halfOpen when using errorFilter

Fix issue #388

+56 -15

3 comments

4 changed files

jairelton

pr closed time in 2 months

pull request commentnodeshift/opossum

Fix stuck halfOpen when using errorFilter

@lholmquist I'm going to land this for now, but let's keep an eye on how filters/fallbacks are used going forward.

jairelton

comment created time in 2 months

Pull request review commentnodeshift/opossum

Fix stuck halfOpen when using errorFilter

 class CircuitBreaker extends EventEmitter {  function handleError (error, circuit, timeout, args, latency, resolve, reject) {   clearTimeout(timeout);++  if (circuit.options.errorFilter(error)) {+    circuit.emit('success', error, latency);+    return reject(error);

I think I'm good with this (until I'm not - lol).

jairelton

comment created time in 2 months

push eventopenshift-cloud-functions/faas-js-runtime

Lance Ball

commit sha 0af91a49bfaefc79e7e4780bd0469e424c753547

chore(release): 0.1.0

view details

push time in 2 months

created tagopenshift-cloud-functions/faas-js-runtime

tagv0.1.0

Node.js framework for executing a function that can respond to HTTP and cloud events

created time in 2 months

Pull request review commentnodeshift/opossum

Fix stuck halfOpen when using errorFilter

 class CircuitBreaker extends EventEmitter {  function handleError (error, circuit, timeout, args, latency, resolve, reject) {   clearTimeout(timeout);++  if (circuit.options.errorFilter(error)) {+    circuit.emit('success', error, latency);+    return reject(error);

Agree... what do you think the correct approach is? Always resolve when an error is filtered? I'm OK with that, but it will be at least a minor version bump.

jairelton

comment created time in 2 months

Pull request review commentnodeshift/opossum

Fix stuck halfOpen when using errorFilter

 class CircuitBreaker extends EventEmitter {  function handleError (error, circuit, timeout, args, latency, resolve, reject) {   clearTimeout(timeout);++  if (circuit.options.errorFilter(error)) {+    circuit.emit('success', error, latency);+    return reject(error);

That is a good question. It's complicated.

In the current version, if the error is filtered, but there is no fallback function, no failure event is emitted, but a rejected Promise is returned. If there is a fallback function, a resolved Promise is always returned. In this case, the behavior has been changed so that the fallback function is never called in the event of a filtered error. To remain partially consistent with past behavior, then the promise should be rejected since no fallback is applied.

jairelton

comment created time in 2 months

pull request commentnodeshift/opossum

Fix stuck halfOpen when using errorFilter

@lholmquist do you mind taking a look and letting me know what you think?

jairelton

comment created time in 2 months

PR opened openshift-cloud-functions/faas-js-runtime

Reviewers
feat: add support for 1.0 structured cloud events enhancement

Adds support for Cloud Events 1.0 in structured mode (even though knative doesn't support this yet, afaik). Structured mode is not supported for 0.2 or 0.3 cloud events for this implementation.

Fixes: https://github.com/openshift-cloud-functions/faas-js-runtime/issues/22

+64 -12

0 comment

3 changed files

pr created time in 2 months

create barnchopenshift-cloud-functions/faas-js-runtime

branch : 22-structured-mode

created branch time in 2 months

push eventopenshift-cloud-functions/faas-js-runtime

Lance Ball

commit sha f282e28b2927156380b3c408dd156575ad30a3ea

feat: add support for cloud events version 1.0 (#21) * feat: add support for cloud events version 1.0 * squash: cleaned up error handling

view details

push time in 2 months

PR merged openshift-cloud-functions/faas-js-runtime

feat: add support for cloud events version 1.0 enhancement

Includes some refactoring of the request handling code so that all event handling is done in the same module, and adds better error handling for unknown cloud event versions.

+112 -43

0 comment

5 changed files

lance

pr closed time in 2 months

push eventopenshift-cloud-functions/faas-js-runtime

Daniel Bevenius

commit sha fac7720f90df8739b4f85e552fdeeb31fcbfc0fa

test: make dest. params test quiet (#19)

view details

Daniel Bevenius

commit sha 9af002abbd17c5e645ec76ef8d4ec00dcf72458f

src: fix hack example (#20) This commit adds a require function call for the example in the fixtures directory. This require was previously done by the framework but that was changed which broke this example.

view details

Lance Ball

commit sha 126fad9a4ab31a984ae4286358a9ec1e0cadf996

feat: add support for cloud events version 1.0

view details

Lance Ball

commit sha 790fb5d66cd2f2a95d1fc7274e5a7762f65644aa

squash: cleaned up error handling

view details

push time in 2 months

push eventopenshift-cloud-functions/faas-js-runtime

Daniel Bevenius

commit sha 9af002abbd17c5e645ec76ef8d4ec00dcf72458f

src: fix hack example (#20) This commit adds a require function call for the example in the fixtures directory. This require was previously done by the framework but that was changed which broke this example.

view details

push time in 2 months

PR merged openshift-cloud-functions/faas-js-runtime

src: fix hack example

This commit adds a require function call for the example in the fixtures directory. This require was previously done by the framework but that was changed which broke this example.

+1 -1

0 comment

1 changed file

danbev

pr closed time in 2 months

push eventopenshift-cloud-functions/faas-js-runtime

Daniel Bevenius

commit sha fac7720f90df8739b4f85e552fdeeb31fcbfc0fa

test: make dest. params test quiet (#19)

view details

push time in 2 months

issue openedopenshift-cloud-functions/faas-js-runtime

Add support for batch content mode

https://github.com/cloudevents/spec/blob/v1.0/http-protocol-binding.md#33-batched-content-mode

created time in 2 months

issue openedopenshift-cloud-functions/faas-js-runtime

Add support for structured cloud events

https://github.com/cloudevents/spec/blob/v1.0/http-protocol-binding.md#32-structured-content-mode

created time in 2 months

push eventopenshift-cloud-functions/faas-js-runtime

Lance Ball

commit sha 2c102127e0ebbcf1a7da3db200f013cce13724f7

squash: cleaned up error handling

view details

push time in 2 months

PR opened openshift-cloud-functions/faas-js-runtime

feat: add support for cloud events version 1.0

Includes some refactoring of the request handling code so that all event handling is done in the same module, and adds better error handling for unknown cloud event versions.

+111 -38

0 comment

5 changed files

pr created time in 2 months

create barnchopenshift-cloud-functions/faas-js-runtime

branch : cloud-events-1-0

created branch time in 2 months

fork lance/eventing

Open source specification and implementation of Knative event binding and delivery

fork in 2 months

pull request commentnodeshift/opossum

Fix stuck halfOpen when using errorFilter

@jairelton thanks for making the change. In reviewing it, I realized that past behavior has been that, whether or not the error is filtered, fallback() is called. And if that call succeeds, then a resolved promise is returned. If not, a rejected promise is returned.

What I have suggested you do is changing the the behavior, and now I am having second thoughts about it because this would really be a semver-major change, I think. @lholmquist do you have any thoughts on this?

jairelton

comment created time in 3 months

pull request commentnodeshift/opossum

Fix stuck halfOpen when using errorFilter

Codacy Here is an overview of what got changed by this pull request:


Clones added
============
- test/error-filter-test.js  2
         

See the complete overview on Codacy

jairelton

comment created time in 3 months

push eventopenshift-cloud-functions/faas-js-runtime

Lance Ball

commit sha 632a475094bff4c0abf69a53aef29671c11684d9

src: refactor function invocation to its own module

view details

push time in 3 months

fork lance/stacks

Appsody application stacks

https://appsody.dev

fork in 3 months

Pull request review commentnodeshift/opossum

Fix stuck halfOpen when using errorFilter

 class CircuitBreaker extends EventEmitter {  function handleError (error, circuit, timeout, args, latency, resolve, reject) {   clearTimeout(timeout);-  fail(circuit, error, args, latency);++  if (circuit.options.errorFilter(error)) {+    circuit.emit('success', error, latency);+  } else fail(circuit, error, args, latency);+   const fb = fallback(circuit, error, args);

I think the logic should prevent fallback() from being called if the error is filtered. Should have noticed this in the original review.

jairelton

comment created time in 3 months

more