You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When you start Dev Proxy from an npm script, you get an exception
Expected behaviour
Dev Proxy works just fine
Actual behaviour
npm start
>[email protected] start
> npx concurrently "npx http-server -p 3000 -s""devproxy -c randomerror.devproxyrc.json"
[1] info GenericRandomErrorPlugin: 1 error responses loaded from /Users/waldek/github/pnp/proxy-samples/samples/demo-randomerror-js/devproxy-errors.json
[1] info Dev Proxy API listening on http://localhost:8897...
[1] info Dev Proxy listening on 127.0.0.1:8000...
[1] fail: Microsoft.Extensions.Hosting.Internal.Host[11]
[1] Hosting failed to start
[1] System.InvalidOperationException: Cannot see if a key has been pressed when either application does not have a console or when console input has been redirected from a file. Try Console.In.Peek.
[1] at System.Console.get_KeyAvailable()
[1] at Microsoft.DevProxy.ProxyEngine.ExecuteAsync(CancellationToken stoppingToken) in /Users/waldek/github/waldekmastykarz/dev-proxy/dev-proxy/ProxyEngine.cs:line 165
[1] at Microsoft.Extensions.Hosting.Internal.Host.<StartAsync>b__14_1(IHostedService service, CancellationToken token)
[1] at Microsoft.Extensions.Hosting.Internal.Host.ForeachService[T](IEnumerable`1 services, CancellationToken token, Boolean concurrent, Boolean abortOnFirstException, List`1 exceptions, Func`3 operation)[1] fail An error occurred while running Dev Proxy Exception Details: System.InvalidOperationException: Cannot see if a key has been pressed when either application does not have a console or when console input has been redirected from a file. Try Console.In.Peek.[1] at System.Console.get_KeyAvailable()[1] at Microsoft.DevProxy.ProxyEngine.ExecuteAsync(CancellationToken stoppingToken) in /Users/waldek/github/waldekmastykarz/dev-proxy/dev-proxy/ProxyEngine.cs:line 165[1] at Microsoft.Extensions.Hosting.Internal.Host.<StartAsync>b__14_1(IHostedService service, CancellationToken token)[1] at Microsoft.Extensions.Hosting.Internal.Host.ForeachService[T](IEnumerable`1 services, CancellationToken token, Boolean concurrent, Boolean abortOnFirstException, List`1 exceptions, Func`3 operation)[1] at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken)[1] at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)[1] at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)[1] at Microsoft.DevProxy.CommandHandlers.ProxyCommandHandler.InvokeAsync(InvocationContext context) in /Users/waldek/github/waldekmastykarz/dev-proxy/dev-proxy/CommandHandlers/ProxyCommandHandler.cs:line 69[1] Unhandled exception: System.InvalidOperationException: Cannot see if a key has been pressed when either application does not have a console or when console input has been redirected from a file. Try Console.In.Peek.[1] at System.Console.get_KeyAvailable()[1] at Microsoft.DevProxy.ProxyEngine.ExecuteAsync(CancellationToken stoppingToken) in /Users/waldek/github/waldekmastykarz/dev-proxy/dev-proxy/ProxyEngine.cs:line 165[1] at Microsoft.Extensions.Hosting.Internal.Host.<StartAsync>b__14_1(IHostedService service, CancellationToken token)[1] at Microsoft.Extensions.Hosting.Internal.Host.ForeachService[T](IEnumerable`1 services, CancellationToken token, Boolean concurrent, Boolean abortOnFirstException, List`1 exceptions, Func`3 operation)[1] at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken)[1] at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)[1] at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)[1] at Microsoft.DevProxy.CommandHandlers.ProxyCommandHandler.InvokeAsync(InvocationContext context) in /Users/waldek/github/waldekmastykarz/dev-proxy/dev-proxy/CommandHandlers/ProxyCommandHandler.cs:line 69[1] at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass4_0.<<BuildInvocationChain>b__0>d.MoveNext()[1] --- End of stack trace from previous location ---[1] at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass17_0.<<UseParseErrorReporting>b__0>d.MoveNext()[1] --- End of stack trace from previous location ---[1] at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass12_0.<<UseHelp>b__0>d.MoveNext()[1] --- End of stack trace from previous location ---[1] at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass22_0.<<UseVersionOption>b__0>d.MoveNext()[1] --- End of stack trace from previous location ---[1] at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass19_0.<<UseTypoCorrections>b__0>d.MoveNext()[1] --- End of stack trace from previous location ---[1] at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseSuggestDirective>b__18_0>d.MoveNext()[1] --- End of stack trace from previous location ---[1] at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass16_0.<<UseParseDirective>b__0>d.MoveNext()[1] --- End of stack trace from previous location ---[1] at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<RegisterWithDotnetSuggest>b__5_0>d.MoveNext()[1] --- End of stack trace from previous location ---[1] at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass8_0.<<UseExceptionHandler>b__0>d.MoveNext()[1] devproxy -c randomerror.devproxyrc.json exited with code 0^C[0] npx http-server -p 3000 -s exited with code 0
Description
When you start Dev Proxy from an npm script, you get an exception
Expected behaviour
Dev Proxy works just fine
Actual behaviour
Steps to reproduce
Run https://github.com/pnp/proxy-samples/tree/main/samples/demo-randomerror-js
Dev Proxy Version
v0.23.0
Operating system (environment)
macOS
Shell
zsh
Configuration file
https://github.com/pnp/proxy-samples/tree/main/samples/demo-randomerror-js
Additional Info
No response
The text was updated successfully, but these errors were encountered: