From a66ae33d5d271a401db5c079a5cf21e33c520cac Mon Sep 17 00:00:00 2001 From: Julien Fontanet Date: Mon, 2 May 2022 13:33:18 +0200 Subject: [PATCH] fix(mixins/HttpProxy): don't fail on missing httpServer Introduced by 98641631a Similar to bc7fc750f Which is the case when instanciated from `xo-server-recover-account`. --- @xen-orchestra/mixins/HttpProxy.js | 7 +++++++ CHANGELOG.unreleased.md | 1 + 2 files changed, 8 insertions(+) diff --git a/@xen-orchestra/mixins/HttpProxy.js b/@xen-orchestra/mixins/HttpProxy.js index fb58609aa..847fb6df6 100644 --- a/@xen-orchestra/mixins/HttpProxy.js +++ b/@xen-orchestra/mixins/HttpProxy.js @@ -30,6 +30,13 @@ module.exports = class HttpProxy { #app constructor(app, { httpServer }) { + // don't setup the proxy if httpServer is not present + // + // that can happen when the app is instanciated in another context like xo-server-recover-account + if (httpServer === undefined) { + return + } + this.#app = app const events = new EventListenersManager(httpServer) diff --git a/CHANGELOG.unreleased.md b/CHANGELOG.unreleased.md index 7466afcdf..61178ddd6 100644 --- a/CHANGELOG.unreleased.md +++ b/CHANGELOG.unreleased.md @@ -28,4 +28,5 @@ > > In case of conflict, the highest (lowest in previous list) `$version` wins. +- @xen-orchestra/mixins patch - xo-server patch