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

BotFrameworkAdapter.processActivity() doesn't log or send entire "body" #1246

Merged
merged 2 commits into from
Oct 3, 2019

Conversation

stevengum
Copy link
Member

Due to voiced privacy concerns, BotFrameworkAdapter.processActivity() no longer logs the body which could have been a a string from Error.toString().

When the method throws an error, the error will be constructed with the following string:

`BotFrameworkAdapter.processActivity(): ${ status } ERROR\n ${ body.stack }`

It will also check if (body && (body as Error).stack). If both are true, the constructed error additionally contains the Error.stack.

// Check for an error
if (status >= 400) {
    if (body && (body as Error).stack) {
        throw new Error(`BotFrameworkAdapter.processActivity(): ${ status } ERROR\n ${ body.stack }`);
    } else {
        throw new Error(`BotFrameworkAdapter.processActivity(): ${ status } ERROR`);
    }
}

Example if body is falsey or if the thrown object does not have stack as a property:

Error: BotFrameworkAdapter.processActivity(): 500 ERROR
    at AdapterUnderTest.processActivity (C:\sdk\js\libraries\botbuilder\lib\botFrameworkAdapter.js:586:23)

Example if a caught error contains stack:

Error: BotFrameworkAdapter.processActivity(): 500 ERROR
 Error: 1
    at adapter.processActivity (C:\sdk\js\libraries\botbuilder\tests\botFrameworkAdapter.test.js:490:19)
    at middleware.run (C:\sdk\js\libraries\botbuilder-core\lib\botAdapter.js:55:24)
    at runNext (C:\sdk\js\libraries\botbuilder-core\lib\middlewareSet.js:76:44)
    at Promise.resolve.handlers.(anonymous function) (C:\sdk\js\libraries\botbuilder-core\lib\middlewareSet.js:73:71)
    at Array.BotFrameworkAdapter.use (C:\sdk\js\libraries\botbuilder\lib\botFrameworkAdapter.js:98:19)
    at runNext (C:\sdk\js\libraries\botbuilder-core\lib\middlewareSet.js:73:55)
    at MiddlewareSet.run (C:\sdk\js\libraries\botbuilder-core\lib\middlewareSet.js:83:16)
    at Promise (C:\sdk\js\libraries\botbuilder-core\lib\botAdapter.js:53:29)
    at new Promise (<anonymous>)
    at AdapterUnderTest.runMiddleware (C:\sdk\js\libraries\botbuilder-core\lib\botAdapter.js:52:16)
    at AdapterUnderTest.processActivity (C:\sdk\js\libraries\botbuilder\lib\botFrameworkAdapter.js:554:24)
    at AdapterUnderTest.processActivity (C:\sdk\js\libraries\botbuilder\lib\botFrameworkAdapter.js:583:23)

@coveralls
Copy link

coveralls commented Oct 3, 2019

Pull Request Test Coverage Report for Build 81620

  • 5 of 5 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.008%) to 87.473%

Totals Coverage Status
Change from base Build 81616: 0.008%
Covered Lines: 4506
Relevant Lines: 4965

💛 - Coveralls

@stevengum stevengum merged commit b24d8bc into master Oct 3, 2019
@stevengum stevengum changed the title processActivity() doesn't log or send entire "body" BotFrameworkAdapter.processActivity() doesn't log or send entire "body" Oct 3, 2019
@cleemullins cleemullins deleted the stgum/bfadapter branch October 24, 2019 21:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants