From 409c4ab7f84507a50d4b4d1cf3563748a8ec33e9 Mon Sep 17 00:00:00 2001 From: gak Date: Fri, 5 Jul 2024 10:27:03 +1000 Subject: [PATCH] fix: console was crashing quietly, relative paths (#1979) - Now log why console crashed - Use gitRoot based path for running console --- backend/controller/controller.go | 2 +- cmd/ftl/cmd_serve.go | 1 + frontend/local.go | 3 ++- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/backend/controller/controller.go b/backend/controller/controller.go index 896d373ce5..66811b0c87 100644 --- a/backend/controller/controller.go +++ b/backend/controller/controller.go @@ -113,7 +113,7 @@ func Start(ctx context.Context, config Config, runnerScaling scaling.RunnerScali } else { consoleHandler, err = frontend.Server(ctx, config.ContentTime, config.Bind, config.ConsoleURL) if err != nil { - return err + return fmt.Errorf("could not start console: %w", err) } logger.Infof("Web console available at: %s", config.Bind) } diff --git a/cmd/ftl/cmd_serve.go b/cmd/ftl/cmd_serve.go index 10a7a10442..05573c14db 100644 --- a/cmd/ftl/cmd_serve.go +++ b/cmd/ftl/cmd_serve.go @@ -134,6 +134,7 @@ func (s *serveCmd) run(ctx context.Context, projConfig projectconfig.Config, ini wg.Go(func() error { if err := controller.Start(controllerCtx, config, runnerScaling, dal); err != nil { + logger.Errorf(err, "controller%d failed: %v", i, err) return fmt.Errorf("controller%d failed: %w", i, err) } return nil diff --git a/frontend/local.go b/frontend/local.go index 66f8b45940..6ea258410a 100644 --- a/frontend/local.go +++ b/frontend/local.go @@ -8,6 +8,7 @@ import ( "net/http" "net/http/httputil" "net/url" + "path" "time" "github.com/TBD54566975/ftl/internal" @@ -33,7 +34,7 @@ func Server(ctx context.Context, timestamp time.Time, publicURL *url.URL, allowO return nil, err } - err = exec.Command(ctx, log.Debug, "frontend", "npm", "run", "dev").Start() + err = exec.Command(ctx, log.Debug, path.Join(gitRoot, "frontend"), "npm", "run", "dev").Start() if err != nil { return nil, err }