microsoft / botbuilder-tools

Welcome to the Bot Framework Tools repository, which is the home for a set of tools for developers building bots with the Microsoft Bot Framework
https://github.com/Microsoft/botframework
MIT License
444 stars 262 forks source link

[Dispatch] Dispatch refresh fails using ErrorActionPreference set as Stop #1474

Closed FedericoBernal closed 4 years ago

FedericoBernal commented 4 years ago

Tool

Name: botdispatch Version: 1.7.1 OS: Windows

Describe the bug

Dispatch refresh fails using $ErrorActionPreference set as Stop executed in PowerShell.

To Reproduce

Steps to reproduce the behavior:

  1. Have a deployed dispatch
  2. Open a new instance of PowerShell
  3. Configure $ErrorActionPreference as Stop $ErrorActionPreference = 'Stop'
  4. Execute the dispatch refresh with hardcoded values dispatch refresh --version Dispatch --dispatch "<PATH_TO_DISPATCH_FILE>" --dataFolder "<PATH_TO_DISPATCH_FOLDER>" 2>> "<PATH_TO_LOG_FILE>" | Out-Null
  5. See that the dispatch refresh is stopped and the log file doesn't contain any output

Expected behavior

All the errors should be appended on the log file and the execution should be working successfully.

Additional context

See microsoft/botframework-solutions#3662

Changing the $ErrorActionPreference to Continue, the execution works.

[bug]

tsuwandy commented 4 years ago

@FedericoBernal, when running in PowerShell or remotely from ci/cd pipeline, use "--remote true" for dispatch create/refresh command. This is because dispatch allows std in (piped in output of another the old msbot cli to dispatch cli) -- this behavior is not compatible in powershell. You might still need $ErrorActionPreference to Continue if running from PowerShell.

I'll close this issue and let me know if you are still having issues with Dispatch with the workarounds. Thanks!

FedericoBernal commented 4 years ago

Thanks @tsuwandy for your quick reply. As you mentioned, we still need $ErrorActionPreference to Continue as it's executed from PowerShell after adding the --remote true for the dispatch refresh command.

This issue is solved changing the ErrorActionPreference to Continue :blush:.