From 763ea4d8f984b4859b2322a92ee49e46ca7ca06a Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Fri, 10 Feb 2023 11:54:16 +0000 Subject: [PATCH] Fix issue with MS-SQL, port needs to be a number for the node-mssql package, with env vars it isn't anymore. --- packages/server/src/api/controllers/datasource.ts | 1 - packages/server/src/integrations/microsoftSqlServer.ts | 5 ++++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/server/src/api/controllers/datasource.ts b/packages/server/src/api/controllers/datasource.ts index 469cd29b56..d212f7f361 100644 --- a/packages/server/src/api/controllers/datasource.ts +++ b/packages/server/src/api/controllers/datasource.ts @@ -14,7 +14,6 @@ import { invalidateDynamicVariables } from "../../threads/utils" import { db as dbCore, context, events } from "@budibase/backend-core" import { UserCtx, Datasource, Row } from "@budibase/types" import sdk from "../../sdk" -import { mergeConfigs } from "../../sdk/app/datasources/datasources" export async function fetch(ctx: UserCtx) { // Get internal tables diff --git a/packages/server/src/integrations/microsoftSqlServer.ts b/packages/server/src/integrations/microsoftSqlServer.ts index 437a9812a6..48cb244b84 100644 --- a/packages/server/src/integrations/microsoftSqlServer.ts +++ b/packages/server/src/integrations/microsoftSqlServer.ts @@ -26,7 +26,7 @@ interface MSSQLConfig { user: string password: string server: string - port: number + port: number | string database: string schema: string encrypt?: boolean @@ -108,6 +108,9 @@ class SqlServerIntegration extends Sql implements DatasourcePlus { constructor(config: MSSQLConfig) { super(SqlClient.MS_SQL) this.config = config + if (typeof this.config?.port === "string") { + this.config.port = parseInt(this.config.port) + } const clientCfg = { ...this.config, options: {