From bbed4cce74cd05ba866e4b110886f4431f5768f6 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Mon, 12 Sep 2022 15:16:31 +0100 Subject: [PATCH 1/2] Fixing an intermettient test issue. --- packages/server/src/utilities/fileSystem/index.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/server/src/utilities/fileSystem/index.js b/packages/server/src/utilities/fileSystem/index.js index 518bcc62bd..885b167d5e 100644 --- a/packages/server/src/utilities/fileSystem/index.js +++ b/packages/server/src/utilities/fileSystem/index.js @@ -44,7 +44,15 @@ const NODE_MODULES_PATH = join(TOP_LEVEL_PATH, "node_modules") exports.init = () => { const tempDir = budibaseTempDir() if (!fs.existsSync(tempDir)) { - fs.mkdirSync(tempDir) + // some test cases fire this quickly enough that + // synchronous cases can end up here at the same time + try { + fs.mkdirSync(tempDir) + } catch (err) { + if (!err || err.code !== "EEXIST") { + throw err + } + } } const clientLibPath = join(budibaseTempDir(), "budibase-client.js") if (env.isTest() && !fs.existsSync(clientLibPath)) { From 82ed2d2cb719f7061eb2e4cad3a9ee79e06344eb Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Mon, 12 Sep 2022 15:17:39 +0100 Subject: [PATCH 2/2] Prefer worker/app port to generic port env variable - #7736. --- packages/server/src/environment.js | 4 ++-- packages/worker/src/environment.ts | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/server/src/environment.js b/packages/server/src/environment.js index 7f929f79e1..fe05a296e2 100644 --- a/packages/server/src/environment.js +++ b/packages/server/src/environment.js @@ -37,8 +37,8 @@ function parseIntSafe(number) { let inThread = false module.exports = { - // important - PORT: process.env.PORT || process.env.APP_PORT, + // important - prefer app port to generic port + PORT: process.env.APP_PORT || process.env.PORT, JWT_SECRET: process.env.JWT_SECRET, COUCH_DB_URL: process.env.COUCH_DB_URL, MINIO_URL: process.env.MINIO_URL, diff --git a/packages/worker/src/environment.ts b/packages/worker/src/environment.ts index fd6749a0f7..1e6d0da637 100644 --- a/packages/worker/src/environment.ts +++ b/packages/worker/src/environment.ts @@ -43,7 +43,8 @@ const env = { PLATFORM_URL: process.env.PLATFORM_URL, APPS_URL: process.env.APPS_URL, // ports - PORT: process.env.PORT || process.env.WORKER_PORT, + // prefer worker port to generic port + PORT: process.env.WORKER_PORT || process.env.PORT, CLUSTER_PORT: process.env.CLUSTER_PORT, // flags NODE_ENV: process.env.NODE_ENV,