From 649a4cf1d2a59bcaf113f1878cac4c42a4883ae7 Mon Sep 17 00:00:00 2001 From: Charmander <~@charmander.me> Date: Tue, 20 Jan 2026 14:20:41 -0800 Subject: [PATCH] =?UTF-8?q?pg-connection-string:=20Support=20environments?= =?UTF-8?q?=20where=20node:process=20isn=E2=80=99t=20available?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit by skipping emitting the warning. Fixes #3583. --- packages/pg-connection-string/index.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/pg-connection-string/index.js b/packages/pg-connection-string/index.js index 428dd3ad4..29ffeafd7 100644 --- a/packages/pg-connection-string/index.js +++ b/packages/pg-connection-string/index.js @@ -1,7 +1,5 @@ 'use strict' -const { emitWarning } = require('process') - //Parse method copied from https://github.com/brianc/node-postgres //Copyright (c) 2010-2014 Brian Carlson (brian.m.carlson@gmail.com) //MIT License @@ -213,9 +211,9 @@ function parseIntoClientConfig(str) { } function deprecatedSslModeWarning(sslmode) { - if (!deprecatedSslModeWarning.warned) { + if (!deprecatedSslModeWarning.warned && typeof process !== 'undefined' && process.emitWarning) { deprecatedSslModeWarning.warned = true - emitWarning(`SECURITY WARNING: The SSL modes 'prefer', 'require', and 'verify-ca' are treated as aliases for 'verify-full'. + process.emitWarning(`SECURITY WARNING: The SSL modes 'prefer', 'require', and 'verify-ca' are treated as aliases for 'verify-full'. In the next major version (pg-connection-string v3.0.0 and pg v9.0.0), these modes will adopt standard libpq semantics, which have weaker security guarantees. To prepare for this change: