agnithamohan opened a new issue #12:
URL: https://github.com/apache/openwhisk-pluggable-provider/issues/12


   Hello, 
   
   I've deployed openwhisk to Kubernetes by following 
[openwhisk-deploy-kube](https://github.com/apache/openwhisk-deploy-kube) using 
kind and the helm charts. I'm using an external couchdb as described in [Using 
an external database](https://github.com/apache/openwhisk-deploy-kube). I tried 
to set up the openwhisk pluggable provider and run the tests using ```npm 
test``` but the tests fail. The parameters I set and the steps I followed are 
described below:
   My node version:  v15.13.0  
   ``` 
   cd provider 
   npm install . 
   export DB_URL=172.18.0.1:5984 #url of the external couchdb instance
   export TRIGGERS_DB=trigger_
   export ROUTER_HOST=172.18.0.3:31001 #url of openwhisk nginx container
   export DB_PROTOCOL=http #protocol of external database 
   export DB_HOST=172.18.0.1:5984 #url of the external couchdb instance
   export DB_USERNAME= #username of the external couchdb instance
   export DB_PASSWORD=  #password of the external couchdb instance
   export EVENT_PROVIDER='/path/to/locally/installed/noop-trigger-feed' 
   npm start 
   ```
   The output for the above steps is:
   ```
   > openwhisk-pluggable-provider@0.0.1 start
   > node app.js
   
   [2021-04-05T20:59:22.011Z] [INFO] [??] [pluggableProviderTrigger] 
[createDatabase] creating the trigger database 
http://admin:admin@172.18.0.1:5984
   [2021-04-05T20:59:22.026Z] [INFO] [??] [pluggableProviderTrigger] 
[server.listen] Express server listening on port 8080
   [2021-04-05T20:59:22.056Z] [INFO] [??] [pluggableProviderTrigger] 
[initAllTriggers] resetting system from last state
   ```
   On a separate terminal I ran the following commands:
   ```
   npm install ../../provider/tests/resources/noop-trigger-feed/ # from the 
openwhisk-pluggable-provider/actions/event-actions folder 
   ```
   Then, from the event-actions folder I ran the following script :
   ```
   var test = require('noop-trigger-feed')
   console.log(test)
   ```
   I get this output:
   ```
   [Function (anonymous)] { validate: [AsyncFunction (anonymous)] }
   ```
   This was to ensure the actions have access to the trigger-feed module. I 
then ran these commands:
   ```
   export OPENWHISK_HOME=/home/linuxbrew/.linuxbrew
   export OW_NOOP_FEED=/guest/noop-trigger-feed/changes 
   export OW_APIHOST=172.18.0.3:31001 #url of openwhisk nginx container
   export OW_API_KEY= #auth key set using wsk property 
   export EVENT_PROVIDER='noop-trigger-feed' 
   ./installCatalog.sh <authkey> <url of openwhisk nginx container> <url of the 
external couchdb instance> triggers_ <url of openwhisk nginx container> guest
   ```
   Two actions are created: 
   ```
   actions
   /guest/noop-trigger-feed-web/changesWebAction                          
private nodejs:10
   /guest/noop-trigger-feed/changes                                       
private nodejs:10
   ```
   Then from the provider folder I ran ```npm test``` and got the following 
response:
   ```
   > openwhisk-pluggable-provider@0.0.1 test
   > ava tests/index.js
   
   
     should be able to create trigger with pluggable provider feed source
   
     tests/index.js:58
   
      57:   // register trigger feed with provider                              
              
      58:   const create_result = await ow.feeds.create({name, trigger: 
TEST_TRIGGER, params})
      59:   t.true(create_result.response.success, 'create trigger feed 
worked')              
   
     Rejected promise returned by test. Reason:
   
     OpenWhiskError {
       error: {
         activationId: '8645f18a5f1d470385f18a5f1d27032b',
         annotations: [
           Object { … },
           Object { … },
           Object { … },
           Object { … },
           Object { … },
           Object { … },
         ],
         duration: 1122,
         end: 1617657032394,
         logs: [],
         name: 'changes',
         namespace: 'guest',
         publish: false,
         response: {
           result: Object { … },
           size: 107,
           status: 'application error',
           success: false,
         },
         start: 1617657031272,
         subject: 'guest',
         version: '0.0.1',
       },
       message: 'POST 
https://172.18.0.3:31001/api/v1/namespaces/guest/actions/noop-trigger-feed/changes?blocking=true
 Returned HTTP 502 (Bad Gateway) --> "There was an error processing your 
request."',
       name: 'OpenWhiskError',
       statusCode: 502,
     }
   
     › Client.handleErrors (node_modules/openwhisk/lib/client.js:228:11)
     › node_modules/openwhisk/lib/client.js:155:58
     › tests/index.js:58:25
   
     ─
   
     1 test failed
   
   ```
   
   The activation list of the actions invoked are listed below: 
   ```
   Datetime            Activation ID                    Kind      Start 
Duration   Status            Entity
   2021-04-05 16:10:31 99da0a0121be40179a0a0121be0017b2 nodejs:10 cold  520ms   
   developer error   guest/changesWebAction:0.0.1
   2021-04-05 16:10:31 8645f18a5f1d470385f18a5f1d27032b nodejs:10 cold  1.122s  
   application error guest/changes:0.0.1
   ```
   The activation record of changesWebAction:0.0.1 
   ```
   ok: got activation 99da0a0121be40179a0a0121be0017b2
   {
       "namespace": "guest",
       "name": "changesWebAction",
       "version": "0.0.1",
       "subject": "guest",
       "activationId": "99da0a0121be40179a0a0121be0017b2",
       "start": 1617657031857,
       "end": 1617657032377,
       "duration": 520,
       "statusCode": 0,
       "response": {
           "status": "action developer error",
           "statusCode": 0,
           "success": false,
           "result": {
               "error": "An error has occurred: Error: Cannot find module 
'noop-trigger-feed'"
           }
       },
       "logs": [
           "2021-04-05T21:10:32.375518458Z stdout: { Error: Cannot find module 
'noop-trigger-feed'",
           "2021-04-05T21:10:32.375564293Z stdout:     at 
Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)",
           "2021-04-05T21:10:32.375577739Z stdout:     at Function.Module._load 
(internal/modules/cjs/loader.js:562:25)",
           "2021-04-05T21:10:32.375587707Z stdout:     at Module.require 
(internal/modules/cjs/loader.js:692:17)",
           "2021-04-05T21:10:32.375595405Z stdout:     at require 
(internal/modules/cjs/helpers.js:25:18)",
           "2021-04-05T21:10:32.375609907Z stdout:     at NodeActionRunner.main 
[as userScriptMain] (/nodejsAction/YJEXJc8k/changesWebAction.js:23:27)",
           "2021-04-05T21:10:32.375640264Z stdout:     at Promise 
(/nodejsAction/runner.js:82:35)",
           "2021-04-05T21:10:32.375650058Z stdout:     at new Promise 
(<anonymous>)",
           "2021-04-05T21:10:32.375659087Z stdout:     at NodeActionRunner.run 
(/nodejsAction/runner.js:80:16)",
           "2021-04-05T21:10:32.375667461Z stdout:     at doRun 
(/nodejsAction/src/service.js:196:14)",
           "2021-04-05T21:10:32.375675794Z stdout:     at runCode 
(/nodejsAction/src/service.js:141:20) code: 'MODULE_NOT_FOUND' }",
           "2021-04-05T21:10:32.378297577Z stderr: The action did not 
initialize or run as expected. Log data might be missing."
       ],
       "annotations": [
           {
               "key": "path",
               "value": "guest/noop-trigger-feed-web/changesWebAction"
           },
           {
               "key": "waitTime",
               "value": 221
           },
           {
               "key": "kind",
               "value": "nodejs:10"
           },
           {
               "key": "timeout",
               "value": false
           },
           {
               "key": "limits",
               "value": {
                   "concurrency": 1,
                   "logs": 10,
                   "memory": 256,
                   "timeout": 60000
               }
           },
           {
               "key": "initTime",
               "value": 511
           }
       ],
       "publish": false
   }
   
   ```
   Activation record of guest/changes:0.0.1 
   ```
   ok: got activation 8645f18a5f1d470385f18a5f1d27032b
   {
       "namespace": "guest",
       "name": "changes",
       "version": "0.0.1",
       "subject": "guest",
       "activationId": "8645f18a5f1d470385f18a5f1d27032b",
       "start": 1617657031272,
       "end": 1617657032394,
       "duration": 1122,
       "statusCode": 0,
       "response": {
           "status": "application error",
           "statusCode": 0,
           "success": false,
           "result": {
               "error": {
                   "code": "KDHvAe8zVl8ox5bnsWV90FxSMwbjaxHv",
                   "error": "There was an error processing your request."
               }
           }
       },
       "logs": [
           "2021-04-05T21:10:31.608906466Z stdout: 
https://172.18.0.1:31001/api/v1/web/guest/noop-trigger-feed-web/changesWebAction.http
 { authKey: undefined,",
           "2021-04-05T21:10:31.608958563Z stdout:   trigger_payload: { value: 
'testing 1 2 3' },",
           "2021-04-05T21:10:31.608969927Z stdout:   NAMESPACE: 'guest',",
           "2021-04-05T21:10:31.608979978Z stdout:   triggerName: 
':guest:test-trigger' } post",
           "2021-04-05T21:10:32.391063526Z stdout: pluggableProvider: Error 
invoking whisk action: 400 { code: 'KDHvAe8zVl8ox5bnsWV90FxSMwbjaxHv',",
           "2021-04-05T21:10:32.391099821Z stdout:   error: 'There was an error 
processing your request.' }"
       ],
       "annotations": [
           {
               "key": "path",
               "value": "guest/noop-trigger-feed/changes"
           },
           {
               "key": "waitTime",
               "value": 236
           },
           {
               "key": "kind",
               "value": "nodejs:10"
           },
           {
               "key": "timeout",
               "value": false
           },
           {
               "key": "limits",
               "value": {
                   "concurrency": 1,
                   "logs": 10,
                   "memory": 256,
                   "timeout": 90000
               }
           },
           {
               "key": "initTime",
               "value": 330
           }
       ],
       "publish": false
   }
   
   ```
   
   I had made the following changes to the files in the repo: 
   1. Commented out  
[line](https://github.com/apache/openwhisk-pluggable-provider/blob/3e89db4fc6a2f4e17c98de3885ab0d09fe02a31f/installCatalog.sh#L112)
   2. Commented out 
[lines](https://github.com/apache/openwhisk-pluggable-provider/blob/3e89db4fc6a2f4e17c98de3885ab0d09fe02a31f/provider/tests/index.js#L20-L21)
 and replaced with:
   ```
   var test = require('ava')
   var openwhisk = require('openwhisk')
   ```
   due to error. “Cannot use import statement outside a module” 
   3. Added 'ignore_certs: true' to 
[line](https://github.com/apache/openwhisk-pluggable-provider/blob/3e89db4fc6a2f4e17c98de3885ab0d09fe02a31f/provider/tests/index.js#L39)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to