Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Last Errors and Errors tab no populated using FeatherJS #42

Closed
aditya0711 opened this issue Jul 11, 2018 · 4 comments
Closed

Last Errors and Errors tab no populated using FeatherJS #42

aditya0711 opened this issue Jul 11, 2018 · 4 comments
Assignees
Labels

Comments

@aditya0711
Copy link

swsAPIstats.js

Error thrown at line 513
this.promClientMetrics.api_response_size_bytes.labels(req.method,req.sws.api_path,res.statusCode).observe( req.sws.res_clength ? req.sws.res_clength : 0 );

if(req.sws.res_clength) = null. if response.c_length = 0;

Propagated from all the way from response intercept.

FIX
this.promClientMetrics.api_response_size_bytes.labels(req.method,req.sws.api_path,res.statusCode).observe( req.sws.res_clength ? req.sws.res_clength : 0 );

added a ternary operator to fix the issue.

Let me know if this is an actual bug, will submit a PR.

@aditya0711
Copy link
Author

Actually, backtracked it to
swsCoreStats.js line 211

        resContentLength = res['_contentLength']; // doesn't check if it's null. Can add a check if res._contentLength is null, it will jump to taking the value from the header. 
    }else{
        // Try header
        if(res.hasHeader('content-length')) {
            resContentLength = res.getHeader('content-length');
        }
    }```

@aditya0711
Copy link
Author

Changing the above code to the following worked for me:



    if ("_contentLength" in res && res['_contentLength'] !== null ){
        resContentLength = res['_contentLength'];
    }else{
        // Try header
        if(res.getHeader('content-length') !==null ) {
            resContentLength = parseInt(res.getHeader('content-length'));
        }
    }

@sv2
Copy link
Collaborator

sv2 commented Jul 11, 2018

Thank you!

@sv2 sv2 added the bug label Jul 11, 2018
@sv2
Copy link
Collaborator

sv2 commented Jul 11, 2018

Addressed in v0.95.6

@sv2 sv2 closed this as completed Jul 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants