Comments (4)
I've been looking into surfacing HTTP traces to assist debugging issues. This library uses the request npm module as the HTTP client. I've discovered this library supports a configuration flag to dump HTTP traffic.
NODE_DEBUG=request node script.js
Here's an example of the output for the following code.
var ow = openwhisk({api_key: 'xxx:yyy', apihost: 'openwhisk.ng.bluemix.net', namespace: '[email protected]_dev'});
ow.actions.list().then(console.log).catch(console.log)
NODE_DEBUG=request node test.js
REQUEST { json: true,
method: 'GET',
url: 'https://openwhisk.ng.bluemix.net/api/v1/namespaces/james.thomas%40uk.ibm.com_dev/actions',
rejectUnauthorized: true,
headers: { Authorization: 'Basic xxxxxx=' },
qs: {},
callback: undefined,
transform: undefined,
simple: true,
resolveWithFullResponse: false }
REQUEST make request https://openwhisk.ng.bluemix.net/api/v1/namespaces/james.thomas%40uk.ibm.com_dev/actions
REQUEST onRequestResponse https://openwhisk.ng.bluemix.net/api/v1/namespaces/james.thomas%40uk.ibm.com_dev/actions 200 { 'x-backside-transport': 'OK OK',
connection: 'close',
'transfer-encoding': 'chunked',
server: 'nginx/1.11.10',
date: 'Sat, 11 Mar 2017 08:48:07 GMT',
'content-type': 'application/json; charset=UTF-8',
'access-control-allow-origin': '*',
'access-control-allow-headers': 'Authorization, Content-Type',
'x-global-transaction-id': '3848629955',
'set-cookie': [ 'DPJSESSIONID=xxxx; Path=/; Domain=.whisk.ng.bluemix.net' ] }
REQUEST reading response's body
REQUEST finish init function https://openwhisk.ng.bluemix.net/api/v1/namespaces/james.thomas%40uk.ibm.com_dev/actions
REQUEST response end https://openwhisk.ng.bluemix.net/api/v1/namespaces/james.thomas%40uk.ibm.com_dev/actions 200 { 'x-backside-transport': 'OK OK',
connection: 'close',
'transfer-encoding': 'chunked',
server: 'nginx/1.11.10',
date: 'Sat, 11 Mar 2017 08:48:07 GMT',
'content-type': 'application/json; charset=UTF-8',
'access-control-allow-origin': '*',
'access-control-allow-headers': 'Authorization, Content-Type',
'x-global-transaction-id': '3848629955',
'set-cookie': [ 'DPJSESSIONID=xxxx; Path=/; Domain=.whisk.ng.bluemix.net' ] }
REQUEST end event https://openwhisk.ng.bluemix.net/api/v1/namespaces/james.thomas%40uk.ibm.com_dev/actions
REQUEST has body https://openwhisk.ng.bluemix.net/api/v1/namespaces/james.thomas%40uk.ibm.com_dev/actions 945
REQUEST emitting complete https://openwhisk.ng.bluemix.net/api/v1/namespaces/james.thomas%40uk.ibm.com_dev/actions
This looks like a good solution for helping to get HTTP traffic when encountering issues.
@rabbah & @starpit - what do you think? is this enough?
If we like this, I'll document it in the README.md as our solution.
from openwhisk-client-js.
For me, the main thing is being specific about failures. The cli has the same problem (and itself had open issues on this very point).
Right now, I neither get specifics about my failing request, nor (and worse, in my opinion) a helpful stack trace. The stack trace is blinded by some async intermediary.
With the proposal, I would... somehow have to re-execute my failing request? This won't help with prod failures. And, anyway, how does one inject an envvar in to a whisk-excuted action?
from openwhisk-client-js.
I've added information about this feature to the README.
https://github.com/openwhisk/openwhisk-client-js/blob/master/README.md#debugging
Turning this on at runtime can be done like....
process.env.NODE_DEBUG='request';
var openwhisk = require('openwhisk');
function main(params) {
var ow = openwhisk();
return ow.actions.list().then(arr => ({result: arr}))
}
from openwhisk-client-js.
@starpit I agree that the error responses from the library could be more helpful but I think some of that is due to that platform responses.
I'm going to close this ticket as resolved and can we open another issue for error messages and discuss requirements?
from openwhisk-client-js.
Related Issues (20)
- main.d.ts (typescript declarations) are a missing some optional arguments HOT 1
- Remove `version` option from actions
- Integration tests are broken with feed testing failing.
- Update package dependencies to latest versions.
- Add CI/CD tools for NPM module dependency management. HOT 3
- CI/CD pipeline should test on all Node.js versions in runtime-nodejs
- Remove use of whisk.system packages in integration tests HOT 1
- result only action invokes are not setting proper query parameter
- blocking invoke that is demoted is not handled correctly HOT 1
- Error occurs in typescript project HOT 6
- Allow clients to override the namespace for the api gateway APIs
- Propagate __OW_TRANSACTION_ID when invoking actions
- Unable to create trigger with feed
- Unable to create web and web-secure action HOT 2
- OpenWhiskError message missing activation id HOT 1
- typings do not allow for nodejs:10 action kind HOT 1
- Typescript types incorrect: Missing 'main' property from Action.Exec
- service requests modify query string with every retry
- Missing parameter 'id' in actions.list()
- Please publish a new minor version 3.22.0 HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from openwhisk-client-js.