Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
fix: handle 'role does not exist' error for PG gateway connection test (#5802)
devin-ai-integration[bot]7f1f7bbe67ac
diff --git a/backend/src/ee/services/pam-resource/shared/sql/sql-resource-factory.ts b/backend/src/ee/services/pam-resource/shared/sql/sql-resource-factory.tsindex d987da6584..f3ff03e703 100644--- a/backend/src/ee/services/pam-resource/shared/sql/sql-resource-factory.ts+++ b/backend/src/ee/services/pam-resource/shared/sql/sql-resource-factory.ts@@ -105,7 +105,8 @@ const makeSqlConnection = (// (like being able to do an auth handshake regardless pass or not)if (connectOnly &&- error.message === `password authentication failed for user "${TEST_CONNECTION_USERNAME}"`+ (error.message === `password authentication failed for user "${TEST_CONNECTION_USERNAME}"` ||+ error.message === `role "${TEST_CONNECTION_USERNAME}" does not exist`)) {return;}@@ -343,7 +344,10 @@ export const sqlResourceFactory: TPamResourceFactory<} catch (error) {// TODO: extract these logic into each SQL connectionif (error instanceof BadRequestError) {- if (error.message === `password authentication failed for user "${credentials.username}"`) {+ if (+ error.message === `password authentication failed for user "${credentials.username}"` ||+ error.message === `role "${credentials.username}" does not exist`+ ) {throw new BadRequestError({message: "Account credentials invalid: Username or password incorrect"});@@ -385,7 +389,10 @@ export const sqlResourceFactory: TPamResourceFactory<);} catch (error) {if (error instanceof BadRequestError) {- if (error.message === `password authentication failed for user "${rotationAccountCredentials.username}"`) {+ if (+ error.message === `password authentication failed for user "${rotationAccountCredentials.username}"` ||+ error.message === `role "${rotationAccountCredentials.username}" does not exist`+ ) {throw new BadRequestError({message: "Management credentials invalid: Username or password incorrect"});