riok / Kreya

Kreya is a GUI client for gRPC and REST APIs with innovative features for environments, authorizations and more.
https://kreya.app
284 stars 5 forks source link

Using `--verbose` inside the Docker container causes exception #201

Closed mfridrikhson-tp closed 5 months ago

mfridrikhson-tp commented 7 months ago

Describe the bug When running operation invoke or collection invoke using Docker image the command errors out with System.NullReferenceException.

System.NullReferenceException: Object reference not set to an instance of an object.
   at Kreya.Cli.Verbose.VerboseDelegateTerminal.get_IsOutputRedirected()
   at Kreya.Cli.Api.Rendering.ConsoleExtensions.Write(IConsole console, ConsoleColor color, String text)
   at Kreya.Cli.Invoker.CliInvokerTracingConsumer.Consume(TraceMessage message)
   at Kreya.Cli.Api.Invoker.CliInvokerMessageConsumerAdapter`1.Consume(InvokerMessage message)
   at Kreya.Cli.Invoker.CliOperationObserverBag.Consume(InvokerMessage message)
   at Kreya.Cli.Invoker.CliInvoker`1.<>c__DisplayClass9_0.<InvokeOperation>b__0(Object _, MessageEventArgs e)
   at Kreya.Core.Invoker.InvokerScope.<>c__DisplayClass30_0.<Initialize>b__1(Object _, MessageEventArgs args)
   at Kreya.Core.Invoker.OperationInvoker.MessageReceived(InvokerMessage msg)
   at Kreya.Core.Invoker.OperationInvoker.PassThroughMessage(InvokerMessage msg)
   at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_1(Object state)
   at System.Threading.QueueUserWorkItemCallback.Execute()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()

To Reproduce Steps to reproduce the behavior:

  1. Clone https://github.com/riok/Kreya and cd inside the project
  2. Run docker run --rm -v $(pwd)/example-project:/example-project riok/kreyac kreyac operation invoke -p /example-project -v 'grpc/**.krop'
  3. See error

Expected behavior Command is completed successfully and verbose output is printed in terminal.

Environment (if possible, copy the information from the error dialog or the About menu):

Version               1.13.1                        
Release channel       Stable                        
Telemetry enabled     True                          
Theme                 OsDefault                     
Runtime identifier    linux-arm64                   
OS Version            Unix 6.4.16.0                 
OS Description        Debian GNU/Linux 12 (bookworm)
OS architecture       Arm64                         
Process architecture  Arm64             
ni507 commented 6 months ago

This is because the docker container does not understand the colors used in the terminal. With docker run -t this will work. https://docs.docker.com/reference/cli/docker/container/run/#tty

We will also fix this in the next release to have a fallback without colors.

CommonGuy commented 6 months ago

This should be fixed with the newest beta release, which you could use with riok/kreyac:beta. The fix will be included in the next stable release

CommonGuy commented 5 months ago

Kreya 1.14 has been released, which fixes this