From 3aaaad879259f05a6c0633995a3b0f1ef8bfc81c Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Tue, 13 Jun 2023 10:48:42 +0100 Subject: [PATCH 1/3] Update mongodb --- packages/server/package.json | 2 +- yarn.lock | 29 +++++++++++++---------------- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/packages/server/package.json b/packages/server/package.json index 6e74de6afa..fb4a4d62e5 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -97,7 +97,7 @@ "koa2-ratelimit": "1.1.1", "lodash": "4.17.21", "memorystream": "0.3.1", - "mongodb": "4.9", + "mongodb": "5.6", "mssql": "6.2.3", "mysql2": "2.3.3", "node-fetch": "2.6.7", diff --git a/yarn.lock b/yarn.lock index ea9823b58b..c8fbdd092c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7989,12 +7989,10 @@ bson@*: resolved "https://registry.yarnpkg.com/bson/-/bson-5.0.1.tgz#4cd3eeeabf6652ef0d6ab600f9a18212d39baac3" integrity sha512-y09gBGusgHtinMon/GVbv1J6FrXhnr/+6hqLlSmEFzkz6PodqF6TxjyvfvY3AfO+oG1mgUtbC86xSbOlwvM62Q== -bson@^4.7.0: - version "4.7.2" - resolved "https://registry.yarnpkg.com/bson/-/bson-4.7.2.tgz#320f4ad0eaf5312dd9b45dc369cc48945e2a5f2e" - integrity sha512-Ry9wCtIZ5kGqkJoi6aD8KjxFZEx78guTQDnpXWiNthsxzrxAK/i8E6pCHAIZTbaEFWcOCvbecMukfK7XUvyLpQ== - dependencies: - buffer "^5.6.0" +bson@^5.3.0: + version "5.3.0" + resolved "https://registry.yarnpkg.com/bson/-/bson-5.3.0.tgz#37b006df4cd91ed125cb686467c1dd6d4606b514" + integrity sha512-ukmCZMneMlaC5ebPHXIkP8YJzNl5DC41N5MAIvKDqLggdao342t4McltoJBQfQya/nHBWAcSsYRqlXPoQkTJag== buffer-alloc-unsafe@^1.1.0: version "1.1.0" @@ -18210,7 +18208,7 @@ moment@^2.29.4: resolved "https://registry.yarnpkg.com/moment/-/moment-2.29.4.tgz#3dbe052889fe7c1b2ed966fcb3a77328964ef108" integrity sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w== -mongodb-connection-string-url@^2.5.3: +mongodb-connection-string-url@^2.6.0: version "2.6.0" resolved "https://registry.yarnpkg.com/mongodb-connection-string-url/-/mongodb-connection-string-url-2.6.0.tgz#57901bf352372abdde812c81be47b75c6b2ec5cf" integrity sha512-WvTZlI9ab0QYtTYnuMLgobULWhokRjtC7db9LtcVfJ+Hsnyr5eo6ZtNAt3Ly24XZScGMelOcGtm7lSn0332tPQ== @@ -18218,15 +18216,14 @@ mongodb-connection-string-url@^2.5.3: "@types/whatwg-url" "^8.2.1" whatwg-url "^11.0.0" -mongodb@4.9: - version "4.9.1" - resolved "https://registry.yarnpkg.com/mongodb/-/mongodb-4.9.1.tgz#0c769448228bcf9a6aa7d16daa3625b48312479e" - integrity sha512-ZhgI/qBf84fD7sI4waZBoLBNJYPQN5IOC++SBCiPiyhzpNKOxN/fi0tBHvH2dEC42HXtNEbFB0zmNz4+oVtorQ== +mongodb@5.6: + version "5.6.0" + resolved "https://registry.yarnpkg.com/mongodb/-/mongodb-5.6.0.tgz#caff5278341bfc0f1ef6f394bb403d207de03d1e" + integrity sha512-z8qVs9NfobHJm6uzK56XBZF8XwM9H294iRnB7wNjF0SnY93si5HPziIJn+qqvUR5QOff/4L0gCD6SShdR/GtVQ== dependencies: - bson "^4.7.0" - denque "^2.1.0" - mongodb-connection-string-url "^2.5.3" - socks "^2.7.0" + bson "^5.3.0" + mongodb-connection-string-url "^2.6.0" + socks "^2.7.1" optionalDependencies: saslprep "^1.0.3" @@ -23100,7 +23097,7 @@ socks-proxy-agent@^7.0.0: debug "^4.3.3" socks "^2.6.2" -socks@^2.3.3, socks@^2.6.2, socks@^2.7.0: +socks@^2.3.3, socks@^2.6.2, socks@^2.7.1: version "2.7.1" resolved "https://registry.yarnpkg.com/socks/-/socks-2.7.1.tgz#d8e651247178fde79c0663043e07240196857d55" integrity sha512-7maUZy1N7uo6+WVEX6psASxtNlKaNVMlGQKkG/63nEDdLOWNbiUMoLK7X4uYoLhQstau72mLgfEWcXcwsaHbYQ== From c1e09d03054a444022f9777abde4455f1f8a9d8c Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Tue, 13 Jun 2023 10:49:09 +0100 Subject: [PATCH 2/3] Close client on testconnection --- packages/server/src/integrations/mongodb.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/server/src/integrations/mongodb.ts b/packages/server/src/integrations/mongodb.ts index 417aa61f41..f076536344 100644 --- a/packages/server/src/integrations/mongodb.ts +++ b/packages/server/src/integrations/mongodb.ts @@ -351,7 +351,7 @@ const SCHEMA: Integration = getSchema() class MongoIntegration implements IntegrationBase { private config: MongoDBConfig - private client: any + private client: MongoClient constructor(config: MongoDBConfig) { this.config = config @@ -372,6 +372,8 @@ class MongoIntegration implements IntegrationBase { response.connected = true } catch (e: any) { response.error = e.message as string + } finally { + await this.client.close() } return response } @@ -380,7 +382,7 @@ class MongoIntegration implements IntegrationBase { return this.client.connect() } - createObjectIds(json: any): object { + createObjectIds(json: any) { const self = this function interpolateObjectIds(json: any) { for (let field of Object.keys(json)) { From d8f9c73193793ce8762cc2fb022dc62a721c75b0 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Tue, 13 Jun 2023 10:50:02 +0100 Subject: [PATCH 3/3] Fix tests --- qa-core/src/integrations/validators/mongo.integration.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qa-core/src/integrations/validators/mongo.integration.spec.ts b/qa-core/src/integrations/validators/mongo.integration.spec.ts index a20b7cd7fa..9132d79f74 100644 --- a/qa-core/src/integrations/validators/mongo.integration.spec.ts +++ b/qa-core/src/integrations/validators/mongo.integration.spec.ts @@ -93,7 +93,7 @@ describe("datasource validators", () => { const result = await integration.testConnection() expect(result).toEqual({ connected: false, - error: "Error: getaddrinfo ENOTFOUND http", + error: "getaddrinfo ENOTFOUND http", }) }) })