Support sending no result from taskModule.submit#636
Support sending no result from taskModule.submit#636th1nkful wants to merge 1 commit intomicrosoft:mainfrom
Conversation
|
Hey @th1nkful thanks for the submission! Would you mind sharing a bit more of your bot code? Are you extending I've tagged aacebo to also take a look to get his experienced feedback :) |
Hi @corinagum , here is the definition for All of the Previously this was used with the Let me know if you need more detail |
|
@th1nkful Thank you! I spoke with the team, and we want to create a sample to test/showcase the behavior before merge, especially since we don't have any Task Module samples yet :O Would you be willing to give it a try, following our general format under /samples? For now, I'm thinking we should make a new folder called 06.taskModules.a.___. If not, no problem! I'll work on getting a sample ready - just note it might take me a little longer due to time constraints. :) Another thing that would be super appreciated is setting up a unit test, if you have the bandwidth. Please let us know! Thank you~ |
Hi @th1nkful, I meant to clarify -- using this code, you are not creating an activity handler, correct? The code you are pulling from is from |
@corinagum the code above with |
| const result = await handler(context, state, context.activity.value?.data ?? {}); | ||
|
|
||
| // if result is null or undefined, this indicates no response should be sent | ||
| if (!result) return; |
There was a problem hiding this comment.
This is incorrect handling. Because this is an invoke, it is expected that a response is sent back, even if there is no body to the response. Like your example code showed, instead of return, it should send the following:
await context.sendActivity({
value: { status: 200 } as InvokeResponse,
type: ActivityTypes.InvokeResponse
});|
Hi @th1nkful, thank you very much for originally reporting this bug and putting up a PR! Since there was a required modification and I was working on other Task Module changes, I went ahead and implemented the requested change in this PR. Therefore I will close this pull request and I have mentioned that original changes started from you in that PR. Thanks again! |
…h and tests (#772) ## Linked issues closes: #635 closes: #247 ## Details - A behavior that was missing from Task Modules was handling submit "continue" scenario when the handler does not return a `TaskModuleResponse` or string. This ensures that the expected response (empty 200) is sent even if there is nothing new to render/send. - Modify so that Teams events check for channelId using `Channels` enum, not 'msteams' string - This included minor refactor for Message Extension and Application as well - Add Task Module tests to get the file to 80% coverage ## Attestation Checklist - [x] My code follows the style guidelines of this project - I have checked for/fixed spelling, linting, and other errors - I have commented my code for clarity - I have made corresponding changes to the documentation (we use [TypeDoc](https://typedoc.org/) to document our code) - My changes generate no new warnings - I have added tests that validates my changes, and provides sufficient test coverage. I have tested with: - Local testing - E2E testing in Teams - New and existing unit tests pass locally with my changes ### Additional information Thank you @th1nkful for the original [PR](#636), which I modified to match Bot Framework protocol :) --------- Co-authored-by: Corina Gum <>
Linked issues
closes: #635
Details
Provide a list of your changes here. If you are fixing a bug, please provide steps to reproduce the bug.
nullorundefinedfromtaskModule.submitwithout having done anything strictly with context and it will show an error "Unable to reach app" even though the intention was to close the appChange details
If developer returns
nullorundefinedfromtaskModule.submitthen no response is given, allowing a task module to close without showing an error windowAdditional information
A PR to go with my issue
Here is a screenshot of the error with the current code:
My code:
If I uncomment the
context.turnState.setline then I am able to close the task module without the error, preserving previous behaviour