You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by al...@apache.org on 2020/04/10 06:52:14 UTC

[openwhisk-wskdebug] branch optional-ngrok created (now cdea63a)

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

alexkli pushed a change to branch optional-ngrok
in repository https://gitbox.apache.org/repos/asf/openwhisk-wskdebug.git.


      at cdea63a  make ngrok an optional dependency

This branch includes the following new commits:

     new d09ee72  better error message if no openwhisk credentials are found
     new 234d3e1  update readme link to ngrok issue
     new 2e36cff  remove debug log
     new cdea63a  make ngrok an optional dependency

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[openwhisk-wskdebug] 03/04: remove debug log

Posted by al...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

alexkli pushed a commit to branch optional-ngrok
in repository https://gitbox.apache.org/repos/asf/openwhisk-wskdebug.git

commit 2e36cff79543ca3d034a209eb1f6f8b6fe87ddbb
Author: Alexander Klimetschek <ak...@adobe.com>
AuthorDate: Thu Apr 9 23:33:40 2020 -0700

    remove debug log
---
 src/debugger.js | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/debugger.js b/src/debugger.js
index b58cd0b..cd8a913 100644
--- a/src/debugger.js
+++ b/src/debugger.js
@@ -34,7 +34,6 @@ class Debugger {
         this.actionName = argv.action;
 
         this.wskProps = wskprops.get();
-        console.log(this.wskProps);
         if (Object.keys(this.wskProps).length === 0) {
             console.error(`Error: Missing openwhisk credentials. Found no ~/.wskprops file or WSK_* environment variable.`);
             process.exit(1);


[openwhisk-wskdebug] 02/04: update readme link to ngrok issue

Posted by al...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

alexkli pushed a commit to branch optional-ngrok
in repository https://gitbox.apache.org/repos/asf/openwhisk-wskdebug.git

commit 234d3e174cd1e53000fba058aacf5c61b17aa1b9
Author: Alexander Klimetschek <ak...@adobe.com>
AuthorDate: Thu Apr 9 23:16:42 2020 -0700

    update readme link to ngrok issue
---
 README.md | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/README.md b/README.md
index d3b8943..c0d61a2 100644
--- a/README.md
+++ b/README.md
@@ -74,7 +74,7 @@ To install or update run:
 npm install -g @openwhisk/wskdebug --unsafe-perm=true
 ```
 
-The `--unsafe-perm=true` is [needed](https://github.com/inconshreveable/ngrok/issues/429) for the ngrok dependency.
+The `--unsafe-perm=true` is [needed](https://github.com/bubenshchykov/ngrok/issues/87) for the ngrok dependency.
 
 <a name="uninstall"></a>
 ### Uninstall
@@ -474,7 +474,7 @@ run this instead:
 sudo npm install -g @openwhisk/wskdebug --unsafe-perm=true --allow-root
 ```
 
-The dependency `ngrok` requires full write permission in `/usr/local/lib/node_modules` during its custom install phase. This is a [known ngrok issue](https://github.com/inconshreveable/ngrok/issues/429).
+The dependency `ngrok` requires full write permission in `/usr/local/lib/node_modules` during its custom install phase. This is a [known ngrok issue](https://github.com/bubenshchykov/ngrok/issues/87).
 
 
 ### Does not work, namespace shows as undefined


[openwhisk-wskdebug] 04/04: make ngrok an optional dependency

Posted by al...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

alexkli pushed a commit to branch optional-ngrok
in repository https://gitbox.apache.org/repos/asf/openwhisk-wskdebug.git

commit cdea63a476256448f68d7f5ce2ce454599c68e70
Author: Alexander Klimetschek <ak...@adobe.com>
AuthorDate: Thu Apr 9 23:50:47 2020 -0700

    make ngrok an optional dependency
    
    had to use peerDependencies in package.json as optionalDependencies
    are still installed by default and ngrok fails without --unsafe-perm=true
    even if in an optionalDependencies
---
 package.json    |  4 +++-
 src/agentmgr.js | 14 ++++++++++++--
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/package.json b/package.json
index 801767f..5f83e6b 100644
--- a/package.json
+++ b/package.json
@@ -46,10 +46,12 @@
         "isomorphic-fetch": "^2.2.1",
         "livereload": "^0.9.1",
         "manakin": "^0.5.2",
-        "ngrok": "^3.2.7",
         "openwhisk": "^3.21.1",
         "yargs": "^15.3.1"
     },
+    "peerDependencies": {
+        "ngrok": "^3.2.7"
+    },
     "devDependencies": {
         "chmodr": "^1.2.0",
         "clone": "^2.1.2",
diff --git a/src/agentmgr.js b/src/agentmgr.js
index 15ea202..c83f31c 100644
--- a/src/agentmgr.js
+++ b/src/agentmgr.js
@@ -17,7 +17,14 @@
 
 'use strict';
 
-const NgrokAgent = require('./agents/ngrok');
+let NgrokAgent;
+try {
+    // optional dependency, only needed if --ngrok is set
+    NgrokAgent = require('./agents/ngrok');
+} catch (err) {
+    NgrokAgent = null
+}
+
 const fs = require('fs-extra');
 const sleep = require('util').promisify(setTimeout);
 
@@ -79,6 +86,10 @@ class AgentMgr {
         this.wsk = wsk;
         this.actionName = actionName;
         this.polling = true;
+
+        if (this.argv.ngrok && !NgrokAgent) {
+            throw new Error("ngrok dependency required for --ngrok is not installed. Please install it using:\n\n    npm install -g ngrok --unsafe-perm=true\n");
+        }
     }
 
     async readAction() {
@@ -140,7 +151,6 @@ class AgentMgr {
         let agentCode;
         if (this.argv.ngrok) {
             // user manually requested ngrok
-
             this.ngrokAgent = new NgrokAgent(this.argv, invoker);
 
             // agent using ngrok for forwarding


[openwhisk-wskdebug] 01/04: better error message if no openwhisk credentials are found

Posted by al...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

alexkli pushed a commit to branch optional-ngrok
in repository https://gitbox.apache.org/repos/asf/openwhisk-wskdebug.git

commit d09ee7289414ae282d1cd9f0fa069a09331c08ab
Author: Alexander Klimetschek <ak...@adobe.com>
AuthorDate: Thu Apr 9 22:44:54 2020 -0700

    better error message if no openwhisk credentials are found
---
 src/debugger.js | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/debugger.js b/src/debugger.js
index 8cf08fb..b58cd0b 100644
--- a/src/debugger.js
+++ b/src/debugger.js
@@ -34,6 +34,11 @@ class Debugger {
         this.actionName = argv.action;
 
         this.wskProps = wskprops.get();
+        console.log(this.wskProps);
+        if (Object.keys(this.wskProps).length === 0) {
+            console.error(`Error: Missing openwhisk credentials. Found no ~/.wskprops file or WSK_* environment variable.`);
+            process.exit(1);
+        }
         if (argv.ignoreCerts) {
             this.wskProps.ignore_certs = true;
         }
@@ -221,7 +226,12 @@ class Debugger {
 
     async setupWsk() {
         if (!this.wsk) {
-            this.wsk = openwhisk(this.wskProps);
+            try {
+                this.wsk = openwhisk(this.wskProps);
+            } catch (err) {
+                console.error(`Error: Could not setup openwhisk client: ${err.message}`);
+                process.exit(1);
+            }
             if (this.wskProps.namespace === undefined) {
                 // there is a strict 1-1 bijection between auth and namespace, hence auth is enough.
                 // while the openwhisk() client does not care about the namespace being set,