cloud-sql-jdbc-socket-factory icon indicating copy to clipboard operation
cloud-sql-jdbc-socket-factory copied to clipboard

"Something unusual has occurred to cause the driver to fail. Please report this exception." with liquibase

Open tiny-dancer opened this issue 3 years ago • 11 comments

Bug Description

"Something unusual has occurred to cause the driver to fail. Please report this exception." When attempting to use com.google.cloud.sql.postgres.SocketFactory with liquibase.

Installed with this JAR https://storage.googleapis.com/cloud-sql-java-connector/v1.6.1/postgres-socket-factory-1.6.1-jar-with-driver-and-dependencies.jar.

Confirmed

Example code (or command)

liquibase --changelog-file=changelog.sql generate-changelog --defaultsFile=liquibase.staging.properties --log-level debug

Stacktrace

./liquibase/liquibase --changelog-file=changelog.sql generate-changelog --defaultsFile=liquibase.staging.properties --log-level debug
[2022-06-15 20:21:45] FINE [liquibase.resource] Adding path /actions-runner/_work/*****Database/*****Database/. to resourceAccessor liquibase.resource.FileSystemResourceAccessor
[2022-06-15 20:21:45] FINE [liquibase.configuration] No configuration value for liquibase.shouldRun aka should.run found
[2022-06-15 20:21:45] FINE [liquibase.configuration] Configuration liquibase.shouldRun is using the default value of true
####################################################
##   _     _             _ _                      ##
##  | |   (_)           (_) |                     ##
##  | |    _  __ _ _   _ _| |__   __ _ ___  ___   ##
##  | |   | |/ _` | | | | | '_ \ / _` / __|/ _ \  ##
##  | |___| | (_| | |_| | | |_) | (_| \__ \  __/  ##
##  \_____/_|\__, |\__,_|_|_.__/ \__,_|___/\___|  ##
##              | |                               ##
##              |_|                               ##
##                                                ## 
##  Get documentation at docs.liquibase.com       ##
##  Get certified courses at learn.liquibase.com  ## 
##  Free schema change activity reports at        ##
##      https://hub.liquibase.com                 ##
##                                                ##
####################################################
Starting Liquibase at 20:21:45 (version 4.11.0 #2708 built at 2022-05-23 15:17+0000)
Liquibase Version: 4.11.0
Liquibase Community 4.11.0 by Liquibase
[2022-06-15 20:21:45] FINE [liquibase.configuration] No configuration value for liquibase.monitorPerformance found
[2022-06-15 20:21:45] FINE [liquibase.configuration] Configuration liquibase.monitorPerformance is using the default value of false
[2022-06-15 20:21:45] FINE [liquibase.integration] Performance monitoring disabled
[2022-06-15 20:21:45] FINE [liquibase.configuration] No configuration value for liquibase.outputFile found
[2022-06-15 20:21:45] FINE [liquibase.configuration] No configuration value for liquibase.strict found
[2022-06-15 20:21:45] FINE [liquibase.configuration] Configuration liquibase.strict is using the default value of false
[2022-06-15 20:21:45] FINE [liquibase.configuration] No configuration value for liquibase.command.generateChangelog.changelogFile found
[2022-06-15 20:21:45] FINE [liquibase.configuration] Found 'liquibase.command.changelogFile' configuration of 'changelog.sql'
    command argument '--changelog-file' of 'changelog.sql'
    Overrides file /actions-runner/_work/*****Database/*****Database/liquibase.staging.properties 'liquibase.command.changelog-file' of 'master.xml'
[2022-06-15 20:21:45] FINE [liquibase.configuration] No configuration value for liquibase.command.generateChangelog.dataOutputDirectory found
[2022-06-15 20:21:45] FINE [liquibase.configuration] No configuration value for liquibase.command.dataOutputDirectory found
[2022-06-15 20:21:45] FINE [liquibase.configuration] No configuration value for liquibase.command.generateChangelog.diffTypes found
[2022-06-15 20:21:45] FINE [liquibase.configuration] No configuration value for liquibase.command.diffTypes found
[2022-06-15 20:21:45] FINE [liquibase.configuration] No configuration value for liquibase.command.generateChangelog.driver found
[2022-06-15 20:21:45] FINE [liquibase.configuration] No configuration value for liquibase.command.driver found
[2022-06-15 20:21:45] FINE [liquibase.configuration] No configuration value for liquibase.command.generateChangelog.driverPropertiesFile found
[2022-06-15 20:21:45] FINE [liquibase.configuration] No configuration value for liquibase.command.driverPropertiesFile found
[2022-06-15 20:21:45] FINE [liquibase.configuration] No configuration value for liquibase.command.generateChangelog.excludeObjects found
[2022-06-15 20:21:45] FINE [liquibase.configuration] No configuration value for liquibase.command.excludeObjects found
[2022-06-15 20:21:45] FINE [liquibase.configuration] No configuration value for liquibase.command.generateChangelog.includeCatalog found
[2022-06-15 20:21:45] FINE [liquibase.configuration] Configuration liquibase.command.generateChangelog.includeCatalog is using the default value of false
[2022-06-15 20:21:45] FINE [liquibase.configuration] No configuration value for liquibase.command.includeCatalog found
[2022-06-15 20:21:45] FINE [liquibase.configuration] Configuration liquibase.command.includeCatalog is using the default value of false
[2022-06-15 20:21:45] FINE [liquibase.configuration] No configuration value for liquibase.command.generateChangelog.includeObjects found
[2022-06-15 20:21:45] FINE [liquibase.configuration] No configuration value for liquibase.command.includeObjects found
[2022-06-15 20:21:45] FINE [liquibase.configuration] No configuration value for liquibase.command.generateChangelog.includeSchema found
[2022-06-15 20:21:45] FINE [liquibase.configuration] Configuration liquibase.command.generateChangelog.includeSchema is using the default value of false
[2022-06-15 20:21:45] FINE [liquibase.configuration] No configuration value for liquibase.command.includeSchema found
[2022-06-15 20:21:45] FINE [liquibase.configuration] Configuration liquibase.command.includeSchema is using the default value of false
[2022-06-15 20:21:45] FINE [liquibase.configuration] No configuration value for liquibase.command.generateChangelog.includeTablespace found
[2022-06-15 20:21:45] FINE [liquibase.configuration] No configuration value for liquibase.command.includeTablespace found
[2022-06-15 20:21:45] FINE [liquibase.configuration] No configuration value for liquibase.command.generateChangelog.overwriteOutputFile found
[2022-06-15 20:21:45] FINE [liquibase.configuration] No configuration value for liquibase.command.overwriteOutputFile found
[2022-06-15 20:21:45] FINE [liquibase.configuration] No configuration value for liquibase.command.generateChangelog.password found
[2022-06-15 20:21:45] FINE [liquibase.configuration] No configuration value for liquibase.command.password found
[2022-06-15 20:21:45] FINE [liquibase.configuration] No configuration value for liquibase.command.generateChangelog.schemas found
[2022-06-15 20:21:45] FINE [liquibase.configuration] No configuration value for liquibase.command.schemas found
[2022-06-15 20:21:45] FINE [liquibase.configuration] No configuration value for liquibase.command.generateChangelog.url found
[2022-06-15 20:21:45] FINE [liquibase.configuration] Found 'liquibase.command.url' configuration of 'jdbc:postgresql:///*****?user=*****&password=*****&cloudSqlInstance=*****cloud1:us-central1:*****-pg&socketFactory=com.google.cloud.sql.postgres.SocketFactory'
    file /actions-runner/_work/*****Database/*****Database/liquibase.staging.properties 'liquibase.command.url' of 'jdbc:postgresql:///*****?user=*****&password=*****&cloudSqlInstance=*****cloud1:us-central1:*****-pg&socketFactory=com.google.cloud.sql.postgres.SocketFactory'
[2022-06-15 20:21:45] FINE [liquibase.configuration] No configuration value for liquibase.command.generateChangelog.username found
[2022-06-15 20:21:45] FINE [liquibase.configuration] No configuration value for liquibase.command.username found
[2022-06-15 20:21:45] FINE [liquibase.command] Pipeline for command 'generateChangelog: liquibase.command.core.GenerateChangelogCommandStep
[2022-06-15 20:21:45] FINE [liquibase.configuration] Configuration liquibase.command.generateChangelog.includeCatalog is using the default value of false
[2022-06-15 20:21:45] FINE [liquibase.configuration] Configuration liquibase.command.includeCatalog is using the default value of false
[2022-06-15 20:21:45] FINE [liquibase.configuration] Configuration liquibase.command.generateChangelog.includeCatalog is using the default value of false
[2022-06-15 20:21:45] FINE [liquibase.configuration] Configuration liquibase.command.includeCatalog is using the default value of false
[2022-06-15 20:21:45] FINE [liquibase.configuration] Configuration liquibase.command.generateChangelog.includeCatalog is using the default value of false
[2022-06-15 20:21:45] FINE [liquibase.configuration] Configuration liquibase.command.includeCatalog is using the default value of false
[2022-06-15 20:21:45] FINE [liquibase.configuration] Configuration liquibase.command.generateChangelog.includeSchema is using the default value of false
[2022-06-15 20:21:45] FINE [liquibase.configuration] Configuration liquibase.command.includeSchema is using the default value of false
[2022-06-15 20:21:45] FINE [liquibase.configuration] Configuration liquibase.command.generateChangelog.includeSchema is using the default value of false
[2022-06-15 20:21:45] FINE [liquibase.configuration] Configuration liquibase.command.includeSchema is using the default value of false
[2022-06-15 20:21:45] FINE [liquibase.configuration] Configuration liquibase.command.generateChangelog.includeSchema is using the default value of false
[2022-06-15 20:21:45] FINE [liquibase.configuration] Configuration liquibase.command.includeSchema is using the default value of false
[2022-06-15 20:21:45] FINE [liquibase.configuration] No configuration value for liquibase.hub.apiKey found
[2022-06-15 20:21:45] FINE [liquibase.configuration] No configuration value for liquibase.propertyProviderClass found
[2022-06-15 20:21:45] FINE [liquibase.configuration] No configuration value for liquibase.databaseClass found
[2022-06-15 20:21:45] FINE [liquibase.configuration] No configuration value for liquibase.hub.url found
[2022-06-15 20:21:45] FINE [liquibase.configuration] Configuration liquibase.hub.url is using the default value of https://hub.liquibase.com
[2022-06-15 20:21:45] FINE [liquibase.integration] Liquibase Hub URL:      https://hub.liquibase.com
[2022-06-15 20:21:45] FINE [liquibase.configuration] Found 'liquibase.hub.mode' configuration of 'OFF'
    file /actions-runner/_work/*****Database/*****Database/liquibase.staging.properties 'liquibase.hub.mode' of 'OFF'
[2022-06-15 20:21:45] FINE [liquibase.integration] Liquibase Hub Mode:     OFF
[2022-06-15 20:21:45] FINE [liquibase.servicelocator] Loaded liquibase.database.Database instance liquibase.database.core.CockroachDatabase
[2022-06-15 20:21:45] FINE [liquibase.servicelocator] Loaded liquibase.database.Database instance liquibase.database.core.DB2Database
[2022-06-15 20:21:45] FINE [liquibase.servicelocator] Loaded liquibase.database.Database instance liquibase.database.core.Db2zDatabase
[2022-06-15 20:21:46] FINE [liquibase.servicelocator] Loaded liquibase.database.Database instance liquibase.database.core.DerbyDatabase
[2022-06-15 20:21:46] FINE [liquibase.servicelocator] Loaded liquibase.database.Database instance liquibase.database.core.EnterpriseDBDatabase
[2022-06-15 20:21:46] FINE [liquibase.servicelocator] Loaded liquibase.database.Database instance liquibase.database.core.Firebird3Database
[2022-06-15 20:21:46] FINE [liquibase.servicelocator] Loaded liquibase.database.Database instance liquibase.database.core.FirebirdDatabase
[2022-06-15 20:21:46] FINE [liquibase.servicelocator] Loaded liquibase.database.Database instance liquibase.database.core.H2Database
[2022-06-15 20:21:46] FINE [liquibase.servicelocator] Loaded liquibase.database.Database instance liquibase.database.core.HsqlDatabase
[2022-06-15 20:21:46] FINE [liquibase.servicelocator] Loaded liquibase.database.Database instance liquibase.database.core.InformixDatabase
[2022-06-15 20:21:46] FINE [liquibase.servicelocator] Loaded liquibase.database.Database instance liquibase.database.core.Ingres9Database
[2022-06-15 20:21:46] FINE [liquibase.servicelocator] Loaded liquibase.database.Database instance liquibase.database.core.MSSQLDatabase
[2022-06-15 20:21:46] FINE [liquibase.servicelocator] Loaded liquibase.database.Database instance liquibase.database.core.MariaDBDatabase
[2022-06-15 20:21:46] FINE [liquibase.servicelocator] Loaded liquibase.database.Database instance liquibase.database.core.MockDatabase
[2022-06-15 20:21:46] FINE [liquibase.servicelocator] Loaded liquibase.database.Database instance liquibase.database.core.MySQLDatabase
[2022-06-15 20:21:46] FINE [liquibase.servicelocator] Loaded liquibase.database.Database instance liquibase.database.core.OracleDatabase
[2022-06-15 20:21:46] FINE [liquibase.servicelocator] Loaded liquibase.database.Database instance liquibase.database.core.PostgresDatabase
[2022-06-15 20:21:46] FINE [liquibase.servicelocator] Loaded liquibase.database.Database instance liquibase.database.core.SQLiteDatabase
[2022-06-15 20:21:46] FINE [liquibase.servicelocator] Loaded liquibase.database.Database instance liquibase.database.core.SybaseASADatabase
[2022-06-15 20:21:46] FINE [liquibase.servicelocator] Loaded liquibase.database.Database instance liquibase.database.core.SybaseDatabase
[2022-06-15 20:21:46] FINE [liquibase.servicelocator] Loaded liquibase.database.Database instance liquibase.database.core.UnsupportedDatabase
[2022-06-15 20:21:46] FINE [liquibase.database] Properties:
[2022-06-15 20:21:46] FINE [liquibase.database] Connecting to the URL:'jdbc:postgresql:///*****?user=*****&password=*****&cloudSqlInstance=*****cloud1:us-central1:*****-pg&socketFactory=com.google.cloud.sql.postgres.SocketFactory' using driver:'org.postgresql.Driver'
[2022-06-15 20:21:46] FINE [liquibase.servicelocator] Loaded liquibase.database.DatabaseConnection instance liquibase.database.jvm.JdbcConnection
[2022-06-15 20:21:46] FINE [liquibase.servicelocator] Loaded liquibase.database.DatabaseConnection instance com.datical.liquibase.ext.database.jvm.ProJdbcConnection
[2022-06-15 20:21:47] SEVERE [liquibase.integration] Connection could not be created to jdbc:postgresql:///*****?user=*****&password=*****&cloudSqlInstance=*****cloud1:us-central1:*****-pg&socketFactory=com.google.cloud.sql.postgres.SocketFactory with driver org.postgresql.Driver.  Something unusual has occurred to cause the driver to fail. Please report this exception.
liquibase.exception.CommandExecutionException: liquibase.exception.LiquibaseException: Unexpected error running Liquibase: liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: Connection could not be created to jdbc:postgresql:///*****?user=*****&password=*****&cloudSqlInstance=*****cloud1:us-central1:*****-pg&socketFactory=com.google.cloud.sql.postgres.SocketFactory with driver org.postgresql.Driver.  Something unusual has occurred to cause the driver to fail. Please report this exception.
	at liquibase.command.CommandScope.execute(CommandScope.java:163)
	at liquibase.integration.commandline.CommandRunner.call(CommandRunner.java:51)
	at liquibase.integration.commandline.CommandRunner.call(CommandRunner.java:21)
	at picocli.CommandLine.executeUserObject(CommandLine.java:1953)
	at picocli.CommandLine.access$1300(CommandLine.java:145)
	at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2358)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2352)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2314)
	at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2179)
	at picocli.CommandLine$RunLast.execute(CommandLine.java:2316)
	at picocli.CommandLine.execute(CommandLine.java:2078)
	at liquibase.integration.commandline.LiquibaseCommandLine.lambda$execute$1(LiquibaseCommandLine.java:336)
	at liquibase.Scope.child(Scope.java:189)
	at liquibase.Scope.child(Scope.java:165)
	at liquibase.integration.commandline.LiquibaseCommandLine.execute(LiquibaseCommandLine.java:301)
	at liquibase.integration.commandline.LiquibaseCommandLine.main(LiquibaseCommandLine.java:90)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at liquibase.integration.commandline.LiquibaseLauncher.main(LiquibaseLauncher.java:91)
Caused by: liquibase.exception.LiquibaseException: Unexpected error running Liquibase: liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: Connection could not be created to jdbc:postgresql:///*****?user=*****&password=*****&cloudSqlInstance=*****cloud1:us-central1:*****-pg&socketFactory=com.google.cloud.sql.postgres.SocketFactory with driver org.postgresql.Driver.  Something unusual has occurred to cause the driver to fail. Please report this exception.
	at liquibase.integration.commandline.Main$1.run(Main.java:443)
	at liquibase.integration.commandline.Main$1.run(Main.java:221)
	at liquibase.Scope.child(Scope.java:189)
	at liquibase.Scope.child(Scope.java:165)
	at liquibase.integration.commandline.Main.run(Main.java:221)
	at liquibase.command.AbstractCliWrapperCommandStep.run(AbstractCliWrapperCommandStep.java:32)
	at liquibase.command.CommandScope.execute(CommandScope.java:157)
	... 20 more
Caused by: liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: Connection could not be created to jdbc:postgresql:///*****?user=*****&password=*****&cloudSqlInstance=*****cloud1:us-central1:*****-pg&socketFactory=com.google.cloud.sql.postgres.SocketFactory with driver org.postgresql.Driver.  Something unusual has occurred to cause the driver to fail. Please report this exception.
	at liquibase.integration.commandline.CommandLineUtils.createDatabaseObject(CommandLineUtils.java:138)
	at liquibase.integration.commandline.Main.doMigration(Main.java:1516)
	at liquibase.integration.commandline.Main$1.lambda$run$0(Main.java:398)
	at liquibase.Scope.lambda$child$0(Scope.java:180)
	at liquibase.Scope.child(Scope.java:189)
	at liquibase.Scope.child(Scope.java:179)
	at liquibase.Scope.child(Scope.java:158)
	at liquibase.integration.commandline.Main$1.run(Main.java:397)
	... 26 more
Caused by: liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: Connection could not be created to jdbc:postgresql:///*****?user=*****&password=*****&cloudSqlInstance=*****cloud1:us-central1:*****-pg&socketFactory=com.google.cloud.sql.postgres.SocketFactory with driver org.postgresql.Driver.  Something unusual has occurred to cause the driver to fail. Please report this exception.
	at liquibase.database.DatabaseFactory.openConnection(DatabaseFactory.java:217)
	at liquibase.database.DatabaseFactory.openConnection(DatabaseFactory.java:176)
	at liquibase.database.DatabaseFactory.openDatabase(DatabaseFactory.java:141)
	at liquibase.integration.commandline.CommandLineUtils.createDatabaseObject(CommandLineUtils.java:92)
	... 33 more
Caused by: liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: Connection could not be created to jdbc:postgresql:///*****?user=*****&password=*****&cloudSqlInstance=*****cloud1:us-central1:*****-pg&socketFactory=com.google.cloud.sql.postgres.SocketFactory with driver org.postgresql.Driver.  Something unusual has occurred to cause the driver to fail. Please report this exception.
	at liquibase.database.ConnectionServiceFactory.create(ConnectionServiceFactory.java:35)
	at liquibase.database.DatabaseFactory.openConnection(DatabaseFactory.java:214)
	... 36 more
Caused by: liquibase.exception.DatabaseException: Connection could not be created to jdbc:postgresql:///*****?user=*****&password=*****&cloudSqlInstance=*****cloud1:us-central1:*****-pg&socketFactory=com.google.cloud.sql.postgres.SocketFactory with driver org.postgresql.Driver.  Something unusual has occurred to cause the driver to fail. Please report this exception.
	at liquibase.database.jvm.JdbcConnection.open(JdbcConnection.java:91)
	at com.datical.liquibase.ext.database.jvm.ProJdbcConnection.open(Unknown Source)
	at liquibase.database.ConnectionServiceFactory.create(ConnectionServiceFactory.java:32)
	... 37 more


Unexpected error running Liquibase: Connection could not be created to jdbc:postgresql:///*****?user=*****&password=*****&cloudSqlInstance=*****cloud1:us-central1:*****-pg&socketFactory=com.google.cloud.sql.postgres.SocketFactory with driver org.postgresql.Driver.  Something unusual has occurred to cause the driver to fail. Please report this exception.

liquibase.exception.CommandExecutionException: liquibase.exception.LiquibaseException: Unexpected error running Liquibase: liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: Connection could not be created to jdbc:postgresql:///*****?user=*****&password=*****&cloudSqlInstance=*****cloud1:us-central1:*****-pg&socketFactory=com.google.cloud.sql.postgres.SocketFactory with driver org.postgresql.Driver.  Something unusual has occurred to cause the driver to fail. Please report this exception.
	at liquibase.command.CommandScope.execute(CommandScope.java:163)
	at liquibase.integration.commandline.CommandRunner.call(CommandRunner.java:51)
	at liquibase.integration.commandline.CommandRunner.call(CommandRunner.java:21)
	at picocli.CommandLine.executeUserObject(CommandLine.java:1953)
	at picocli.CommandLine.access$1300(CommandLine.java:145)
	at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2358)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2352)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2314)
	at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2179)
	at picocli.CommandLine$RunLast.execute(CommandLine.java:2316)
	at picocli.CommandLine.execute(CommandLine.java:2078)
	at liquibase.integration.commandline.LiquibaseCommandLine.lambda$execute$1(LiquibaseCommandLine.java:336)
	at liquibase.Scope.child(Scope.java:189)
	at liquibase.Scope.child(Scope.java:165)
	at liquibase.integration.commandline.LiquibaseCommandLine.execute(LiquibaseCommandLine.java:301)
	at liquibase.integration.commandline.LiquibaseCommandLine.main(LiquibaseCommandLine.java:90)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at liquibase.integration.commandline.LiquibaseLauncher.main(LiquibaseLauncher.java:91)
Caused by: liquibase.exception.LiquibaseException: Unexpected error running Liquibase: liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: Connection could not be created to jdbc:postgresql:///*****?user=*****&password=*****&cloudSqlInstance=*****cloud1:us-central1:*****-pg&socketFactory=com.google.cloud.sql.postgres.SocketFactory with driver org.postgresql.Driver.  Something unusual has occurred to cause the driver to fail. Please report this exception.
	at liquibase.integration.commandline.Main$1.run(Main.java:443)
	at liquibase.integration.commandline.Main$1.run(Main.java:221)
	at liquibase.Scope.child(Scope.java:189)
	at liquibase.Scope.child(Scope.java:165)
	at liquibase.integration.commandline.Main.run(Main.java:221)
	at liquibase.command.AbstractCliWrapperCommandStep.run(AbstractCliWrapperCommandStep.java:32)
	at liquibase.command.CommandScope.execute(CommandScope.java:157)
	... 20 more
Caused by: liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: Connection could not be created to jdbc:postgresql:///*****?user=*****&password=*****&cloudSqlInstance=*****cloud1:us-central1:*****-pg&socketFactory=com.google.cloud.sql.postgres.SocketFactory with driver org.postgresql.Driver.  Something unusual has occurred to cause the driver to fail. Please report this exception.
	at liquibase.integration.commandline.CommandLineUtils.createDatabaseObject(CommandLineUtils.java:138)
	at liquibase.integration.commandline.Main.doMigration(Main.java:1516)
	at liquibase.integration.commandline.Main$1.lambda$run$0(Main.java:398)
	at liquibase.Scope.lambda$child$0(Scope.java:180)
	at liquibase.Scope.child(Scope.java:189)
	at liquibase.Scope.child(Scope.java:179)
	at liquibase.Scope.child(Scope.java:158)
	at liquibase.integration.commandline.Main$1.run(Main.java:397)
	... 26 more
Caused by: liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: Connection could not be created to jdbc:postgresql:///*****?user=*****&password=*****&cloudSqlInstance=*****cloud1:us-central1:*****-pg&socketFactory=com.google.cloud.sql.postgres.SocketFactory with driver org.postgresql.Driver.  Something unusual has occurred to cause the driver to fail. Please report this exception.
	at liquibase.database.DatabaseFactory.openConnection(DatabaseFactory.java:217)
	at liquibase.database.DatabaseFactory.openConnection(DatabaseFactory.java:176)
	at liquibase.database.DatabaseFactory.openDatabase(DatabaseFactory.java:141)
	at liquibase.integration.commandline.CommandLineUtils.createDatabaseObject(CommandLineUtils.java:92)
	... 33 more
Caused by: liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: Connection could not be created to jdbc:postgresql:///*****?user=*****&password=*****&cloudSqlInstance=*****cloud1:us-central1:*****-pg&socketFactory=com.google.cloud.sql.postgres.SocketFactory with driver org.postgresql.Driver.  Something unusual has occurred to cause the driver to fail. Please report this exception.
	at liquibase.database.ConnectionServiceFactory.create(ConnectionServiceFactory.java:35)
	at liquibase.database.DatabaseFactory.openConnection(DatabaseFactory.java:214)
	... 36 more
Caused by: liquibase.exception.DatabaseException: Connection could not be created to jdbc:postgresql:///*****?user=*****&password=*****&cloudSqlInstance=*****cloud1:us-central1:*****-pg&socketFactory=com.google.cloud.sql.postgres.SocketFactory with driver org.postgresql.Driver.  Something unusual has occurred to cause the driver to fail. Please report this exception.
	at liquibase.database.jvm.JdbcConnection.open(JdbcConnection.java:91)
	at com.datical.liquibase.ext.database.jvm.ProJdbcConnection.open(Unknown Source)
	at liquibase.database.ConnectionServiceFactory.create(ConnectionServiceFactory.java:32)
	... 37 more

How to reproduce

sudo apt install unzip default-jre -y
        if [ ! -f ./liquibase/liquibase ]
        then
          echo "Downloading liquibase..."
          curl -L https://github.com/liquibase/liquibase/releases/download/v4.11.0/liquibase-4.11.0.zip --output liquibase.zip
          unzip -o -d liquibase liquibase.zip
          rm -f liquibase.zip
        fi

        if [ ! -f ./liquibase/lib/postgres-socket-factory.jar ]
        then
          echo "Downloading cloud sql postgres socket factory..."
          curl -L https://storage.googleapis.com/cloud-sql-java-connector/v1.6.1/postgres-socket-factory-1.6.1-jar-with-driver-and-dependencies.jar  --output postgres-socket-factory.jar
          mv postgres-socket-factory.jar ./liquibase/lib/postgres-socket-factory.jar
        fi
  1. ./liquibase/liquibase --changelog-file=changelog.sql generate-changelog --defaultsFile=liquibase.staging.properties --log-level debug

Environment

  1. OS type and version: Ubuntu 20.04
  2. Java SDK version: openjdk version "11.0.15" 2022-04-19
  3. Socket Factory version: 1.61
  4. Liquibase Version: 4.11.0 Liquibase Community 4.11.0 by Liquibase
  5. Running on GCP VM with editor level service account and confirmed gcloud auth application-default print-access-token returns an access token

tiny-dancer avatar Jun 15 '22 20:06 tiny-dancer

Hi @tiny-dancer, thanks for opening this issue! I'll take a look soon and keep you updated.

Does connecting work with previous releases? Like if you were to use the jar for v1.5.0, does it work?

shubha-rajan avatar Jun 15 '22 21:06 shubha-rajan

@shubha-rajan thanks for the quick response. I attempted with 1.5.0 and encountered the same error. Also tried both with-dependences and with-driver-and-dependencies and same error.

Is there a way to enable debug logs or something with in cloud sql socket factory? Flying a little blind. attempted to set the below with no luck for additional insight: export JAVA_OPTS=-Djava.util.logging.config.file="logging.properties"

with logging.properties:

com.google.cloud.sql.level = FINE

tiny-dancer avatar Jun 15 '22 22:06 tiny-dancer

Note: it did work from local laptop. Have not been able to successfully do it from gcp vm though.

EDIT: after typing that, I attempted to use personal creds over the vm service account creds as application default in vm - no luck.

tiny-dancer avatar Jun 15 '22 22:06 tiny-dancer

@tiny-dancer Glad to hear you got this to work on your laptop. The error message isn't very helpful, though, is it?

I'll try to reproduce on a GCE VM and report back on what I find. My first impression is that this is a credential problem that doesn't result in a good error.

enocom avatar Jun 21 '22 20:06 enocom

So I reproduced the problem on a VM that had only the "Default Access" scopes configured. When I updated the scopes to include "Cloud SQL", the error went away.

There are some more details here: https://cloud.google.com/compute/docs/access/service-accounts#accesscopesiam

Would you like to try updating the access scopes and trying again?

enocom avatar Jun 21 '22 21:06 enocom

Feel free to re-open if that doesn't work.

enocom avatar Jun 21 '22 21:06 enocom

@enocom thanks for the response. was unable to resolve the issue with the cloud-platform access scope which is visualized in the UI as Allow full access to all Cloud APIs. Adding the sql-admin scope in addition to cloud-platform did not resolve the issue either.

Consider this reopened (don't believe i can actually do that)

tiny-dancer avatar Jun 23 '22 22:06 tiny-dancer

@shubha-rajan Mind taking a look?

enocom avatar Jun 24 '22 18:06 enocom

Hi @tiny-dancer, just to confirm, you tried enabling the Cloud SQL API on your compute engine VM? For reference, when you look at your VM in the web UI, you should see something like this: image Make sure Cloud SQL is enabled.

shubha-rajan avatar Jun 24 '22 18:06 shubha-rajan

I think that there is some underlying issue preventing the connection from being created, but is is being buried in the Liquibase stack trace. Is it possible to get a more complete stack trace?

kurtisvg avatar Jun 29 '22 22:06 kurtisvg

We need more information about the exact problem to try to resolve this issue. The exception provided is not detailed enough due to deficiencies in Liquibase's error handling.

The nested cause from Liquibase is here JdbcConnection.java:91, which eats the caused by exception.

Based on the message, "Something unusual occurred...", the exception that Liquibase ate is a PSQLException thrown from here message happens when org.postgresql.Driver catches an Exception while trying to evaluate connection properties and connect for the first time.

So it seems the root cause is somewhere in com.google.cloud.sql.postgres.SocketFactory. However it is not clear from the errors whether this is related to changes in the dependencies for socket factory 1.61, permissions, or something else. I submitted a PR to Liquibase to try to get more of the stack trace in the log.

I was able to reproduce this error from liquibase on a GCP Ubuntu VM when the VM's service account does not have permission to access the cloud sql api. I corrected this with the following steps:

  1. Add the "cloud sql admin" role to the compute default service account in IAM
  2. Stop the VM
  3. Edit the VM's scopes to allow the VM to connect to cloud sql as @shubha-rajan described above
  4. Start the VM

However, as I said above, I'm not sure if you having this exact problem or a different one that produces the same kind of error.

We need your help to gather more data before we can go further.

If you are able, please try running this simple Java program to see exactly what kind of socket connection error is being thrown

Copy this into a file named Main.java and edit the value of DB_URL, USER, and PASS as appropriate for your database.


import java.sql.*;

public class Main {
   static final String DB_URL = "jdbc:postgresql:///db?cloudSqlInstance=<INSTANCE_CONN>&socketFactory=com.google.cloud.sql.postgres.SocketFactory";
   static final String USER = "guest";
   static final String PASS = "guest123";
   static final String QUERY = "SELECT 1";

   public static void main(String[] args) {
      // Open a connection
      try(Connection conn = DriverManager.getConnection(DB_URL, USER, PASS);
         Statement stmt = conn.createStatement();
         ResultSet rs = stmt.executeQuery(QUERY);) {
         // Extract data from result set
         while (rs.next()) {
            // Retrieve by column name
            System.out.print("ID: " + rs.getInt(1));
         }
      } catch (SQLException e) {
         e.printStackTrace();
      } 
   }
}

Then run this script:

sudo apt install -y default-jdk
javac Main.java
java -classpath .:./liquibase/liquibase.jar:./liquibase/lib/postgres-socket-factory.jar Main

If this fails to connect, it will print out the exception that Liquibase has hidden.

If you are feeling ambitious, try using my forked version of liquibase which hopefully will print out a better error message in the debug logs.

hessjcg avatar Jul 01 '22 18:07 hessjcg

Closing this issue since it has been inactive for a few months. Please reopen if you have any further questions.

shubha-rajan avatar Sep 12 '22 16:09 shubha-rajan