This is an automated email from the ASF dual-hosted git repository.

mrutkowski pushed a commit to branch master
in repository 
https://gitbox.apache.org/repos/asf/incubator-openwhisk-devtools.git


The following commit(s) were added to refs/heads/master by this push:
     new ce3d32c  fixing function signature which was causing failure (#254)
ce3d32c is described below

commit ce3d32c9b6ead260fd878fb591a13ef54e6ee03f
Author: Priti Desai <pde...@us.ibm.com>
AuthorDate: Mon Apr 29 05:35:25 2019 -0700

    fixing function signature which was causing failure (#254)
    
    * fixing function signature which was causing failure
    
    * handling condition when req has no init/activation data
    
    * handling condition when req has no init/activation data
---
 knative-build/runtimes/javascript/platform/knative.js | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/knative-build/runtimes/javascript/platform/knative.js 
b/knative-build/runtimes/javascript/platform/knative.js
index 194f4be..442381c 100644
--- a/knative-build/runtimes/javascript/platform/knative.js
+++ b/knative-build/runtimes/javascript/platform/knative.js
@@ -266,7 +266,7 @@ function preProcessRequest(req){
 
         // process initialization (i.e., "init") data
         if (hasInitData(req)) {
-            preProcessInitData(env, initData, valueData, activationData);
+            preProcessInitData(initData, valueData, activationData);
         }
 
         if(hasActivationData(req)) {
@@ -423,7 +423,7 @@ function PlatformKnativeImpl(platformFactory) {
             }
 
             // Different pre-processing logic based upon request data needed 
due Promise behavior
-            if(hasInitData(req) && hasActivationData(req)){
+            if(hasInitData(req) && hasActivationData(req)) {
                 // Request has both Init and Run (activation) data
                 preProcessRequest(req);
                 // Invoke the OW "init" entrypoint
@@ -473,6 +473,20 @@ function PlatformKnativeImpl(platformFactory) {
                         res.status(500).json({ error: "Internal error during 
function execution." });
                     }
                 });
+            } else {
+                preProcessRequest(req);
+                // Invoke the OW "run" entrypoint
+                service.runCode(req).then(function (result) {
+                    postProcessResponse(req, result, res)
+                }).catch(function (error) {
+                    console.error(error);
+                    if (typeof error.code === "number" && typeof 
error.response !== "undefined") {
+                        res.status(error.code).json(error.response);
+                    } else {
+                        console.error("[wrapEndpoint]", "invalid errored 
promise", JSON.stringify(error));
+                        res.status(500).json({ error: "Internal error during 
function execution." });
+                    }
+                });
             }
 
         } catch (e) {

Reply via email to