File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
reverse_engineering/helpers Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -123,20 +123,26 @@ const createClient = async (connectionInfo, logger) => {
123123 application_name : 'Hackolade' ,
124124 } ;
125125
126- const client = await connectClient ( config ) . catch ( retryOnSslError ( connectionInfo , config ) ) ;
126+ const client = await connectClient ( config ) . catch ( retryOnSslError ( connectionInfo , config , logger ) ) ;
127127
128128 return { client, sshTunnel } ;
129129} ;
130130
131- const retryOnSslError = ( connectionInfo , config ) => async error => {
131+ const retryOnSslError = ( connectionInfo , config , logger ) => async error => {
132132 if ( error . message === SSL_NOT_SUPPORTED_MESSAGE && connectionInfo . sslType === 'prefer' ) {
133+ logger . info ( "Retry connection without SSL (SSL mode 'prefer')" ) ;
134+ logger . error ( error ) ;
135+
133136 return await connectClient ( {
134137 ...config ,
135138 ssl : false ,
136139 } ) ;
137140 }
138141
139- if ( error . code === POSTGRES_SSL_REQUIRED_ERROR_CODE && connectionInfo . sslType === 'allow' ) {
142+ if ( error . code ?. toString ( ) === POSTGRES_SSL_REQUIRED_ERROR_CODE && connectionInfo . sslType === 'allow' ) {
143+ logger . info ( "Retry connection with SSL (SSL mode 'allow')" ) ;
144+ logger . error ( error ) ;
145+
140146 return await connectClient ( {
141147 ...config ,
142148 ssl : { rejectUnauthorized : false } ,
You can’t perform that action at this time.
0 commit comments