From b4ffa3bd91444b4f5becab17de1662df7ce3df7f Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Thu, 29 Dec 2022 12:56:55 +0100 Subject: [PATCH] app-backend: avoid warning about missing app contents in development Signed-off-by: Patrik Oldsberg --- .changeset/ninety-phones-tell.md | 5 +++++ plugins/app-backend/src/service/router.ts | 8 +++++--- 2 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 .changeset/ninety-phones-tell.md diff --git a/.changeset/ninety-phones-tell.md b/.changeset/ninety-phones-tell.md new file mode 100644 index 0000000000..692ed27c23 --- /dev/null +++ b/.changeset/ninety-phones-tell.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-app-backend': patch +--- + +The warning for missing app contents is now logged as an error instead, but only in production. diff --git a/plugins/app-backend/src/service/router.ts b/plugins/app-backend/src/service/router.ts index de299fd895..4e94138439 100644 --- a/plugins/app-backend/src/service/router.ts +++ b/plugins/app-backend/src/service/router.ts @@ -96,9 +96,11 @@ export async function createRouter( const staticDir = resolvePath(appDistDir, 'static'); if (!(await fs.pathExists(staticDir))) { - logger.warn( - `Can't serve static app content from ${staticDir}, directory doesn't exist`, - ); + if (process.env.NODE_ENV === 'production') { + logger.error( + `Can't serve static app content from ${staticDir}, directory doesn't exist`, + ); + } return Router(); }