Add a DB to metabase (null value in column “id”)

Adding a AWS Postgres DB:

Enter host, port user pw

ERROR: null value in column “id” violates not-null constraint Detail: Failing row contains (null, 2018-08-24 10:16:37.978-06, 2018-08-24 10:16:37.978-06, xxx, null, {“host”:“ph-xxxxxxx.us-west-2.rds.amazonaws.com”,"p…, postgres, f, t, null, null, 0 50 * * * ? *, 0 50 0 * * ? *, null, f, null).

Looks like metabase is not setting the ID when inserting the DB info.

Anyone seen this ?

It would be useful to know the following about your environment to try to understand/reproduce the problem:

Sorry about that.
Also note that I inserted the record by hand and it works fine.
So I can not duplicate the error.

Interestingly, now do not get the error when I add a DB from that server.
Possible transient AWS error ?

Starting Metabase version v0.30.1 (3df01f7 master)
Running jar file on Win 10 1803
Java™ SE Runtime Environment (build 1.8.0_181-b13)

Remote DB Postgres 9.4 AWS RDS
Note that my metabase DB is on the same server.

No errors on Boot up:

08-24 12:10:16 e[1mINFO metabase.coree[0m :: Starting Metabase version v0.30.1 (3df01f7 master) …
08-24 12:10:16 e[1mINFO metabase.coree[0m :: System timezone is ‘America/Regina’ …
WARNING: any? already refers to: #'clojure.core/any? in namespace: monger.collection, being replaced by: #'monger.collection/any?
08-24 12:10:17 e[1mINFO metabase.coree[0m :: Setting up and migrating Metabase DB. Please sit tight, this may take a minute…
08-24 12:10:17 e[1mINFO metabase.dbe[0m :: Verifying postgres Database Connection …
08-24 12:10:18 e[1mINFO metabase.dbe[0m :: Verify Database Connection …
08-24 12:10:18 e[1mINFO metabase.dbe[0m :: Running Database Migrations…
08-24 12:10:18 e[1mINFO metabase.dbe[0m :: Setting up Liquibase…
08-24 12:10:18 e[1mINFO metabase.dbe[0m :: Liquibase is ready.
08-24 12:10:18 e[1mINFO metabase.dbe[0m :: Checking if Database has unrun migrations…
08-24 12:10:19 e[1mINFO metabase.dbe[0m :: Database Migrations Current …
com.mchange.v2.cfg.DelayedLogItem [ level -> FINE, text -> “The configuration file for resource identifier ‘hocon:/reference,/application,/c3p0,/’ could not be found. Skipping.”, exception -> null]
08-24 12:10:19 e[1mINFO db.migrationse[0m :: Running all necessary data migrations, this may take a minute.
08-24 12:10:20 e[1mINFO db.migrationse[0m :: Finished running data migrations.
08-24 12:10:20 e[1mINFO metabase.eventse[0m :: Starting events listener: metabase.events.activity-feed
08-24 12:10:20 e[1mINFO metabase.eventse[0m :: Starting events listener: metabase.events.dependencies
08-24 12:10:20 e[1mINFO metabase.eventse[0m :: Starting events listener: metabase.events.driver-notifications
08-24 12:10:20 e[1mINFO metabase.eventse[0m :: Starting events listener: metabase.events.last-login
08-24 12:10:20 e[1mINFO metabase.eventse[0m :: Starting events listener: metabase.events.metabot-lifecycle
08-24 12:10:20 e[1mINFO metabase.eventse[0m :: Starting events listener: metabase.events.notifications
08-24 12:10:20 e[1mINFO metabase.eventse[0m :: Starting events listener: metabase.events.revision
08-24 12:10:20 e[1mINFO metabase.eventse[0m :: Starting events listener: metabase.events.sync-database
08-24 12:10:20 e[1mINFO metabase.eventse[0m :: Starting events listener: metabase.events.view-log
08-24 12:10:20 e[1mINFO metabase.taske[0m :: Loading tasks namespace: metabase.task.DynamicClassLoadHelper
08-24 12:10:20 e[1mINFO metabase.taske[0m :: Loading tasks namespace: metabase.task.follow-up-emails
08-24 12:10:20 e[1mINFO metabase.taske[0m :: Job already exists: metabase.task.follow-up-emails.job
08-24 12:10:20 e[1mINFO metabase.taske[0m :: Job already exists: metabase.task.abandonment-emails.job
08-24 12:10:20 e[1mINFO metabase.taske[0m :: Loading tasks namespace: metabase.task.send-anonymous-stats
08-24 12:10:20 e[1mINFO metabase.taske[0m :: Job already exists: metabase.task.anonymous-stats.job
08-24 12:10:20 e[1mINFO metabase.taske[0m :: Loading tasks namespace: metabase.task.send-pulses
08-24 12:10:20 e[1mINFO metabase.taske[0m :: Job already exists: metabase.task.send-pulses.job
08-24 12:10:20 e[1mINFO metabase.taske[0m :: Loading tasks namespace: metabase.task.sync-databases
08-24 12:10:20 e[1mINFO metabase.taske[0m :: Loading tasks namespace: metabase.task.upgrade-checks
08-24 12:10:20 e[1mINFO metabase.taske[0m :: Job already exists: metabase.task.upgrade-checks.job
08-24 12:10:20 e[1mINFO metabase.coree[0m :: Metabase Initialization COMPLETE

No worries! You sound FizzBin enough to me :slight_smile:

Since you got it worked around and you can’t even reproduce right now I think – for now – this will probably just get filed in the interesting-but-not-super-urgent department.

For the record: Seen with 0.30.1 with Postgres (on AWS across internet, if I understood right) as application db.

Thanks Jorn,

Love the FizzBin.

So here’s an update.

I had a local copy of the same DB in metabase. I deleted it. Then went to add it back… guess what…
BTW the local copy is PG 10.1 and was added np with some 30.XX version of metabase before.

Looks similar, but seems the SSL error made this happen. I connect just fine using PgAdmin, no SSL.
Does metbase try SSL first, and if it fails try without ?

Error output:

08-24 13:48:34 e[1mERROR metabase.drivere[0m :: Failed to connect to database: org.postgresql.util.PSQLException: The server does not support SSL.
08-24 13:48:36 e[1mERROR metabase.middlewaree[0m :: POST /api/database 500 (2 s) (1 DB calls).
{:message
"ERROR: null value in column “id” violates not-null constraint\n Detail: Failing row contains (null, 2018-08-24 13:48:34.235-06, 2018-08-24 13:48:34.235-06, xxx, null, {“host”:“localhost”,“port”:2345,“dbname”:“desal_data-good”,“user…, postgres, f, t, null, null, 0 50 * * * ? *, 0 50 0 * * ? *, null, f, null).”,
:type org.postgresql.util.PSQLException,
:stacktrace
[“api.database$fn__44580.invokeStatic(database.clj:395)”
“api.database$fn__44580.invoke(database.clj:379)”
“middleware$enforce_authentication$fn__54666.invoke(middleware.clj:116)”
“api.routes$fn__54812.invokeStatic(routes.clj:64)”
“api.routes$fn__54812.invoke(routes.clj:64)”
“routes$fn__55606$fn__55607.doInvoke(routes.clj:108)”
“routes$fn__55606.invokeStatic(routes.clj:103)”
“routes$fn__55606.invoke(routes.clj:103)”
“middleware$catch_api_exceptions$fn__54795.invoke(middleware.clj:424)”
“middleware$log_api_call$fn__54772$fn__54774.invoke(middleware.clj:351)”
“middleware$log_api_call$fn__54772.invoke(middleware.clj:350)”
“middleware$add_security_headers$fn__54720.invoke(middleware.clj:253)”
“core$wrap_streamed_json_response$fn__56459.invoke(core.clj:67)”
“middleware$bind_current_user$fn__54671.invoke(middleware.clj:140)”
“middleware$maybe_set_site_url$fn__54724.invoke(middleware.clj:277)”],
:sql-exception-chain
[“PSQLException:”
“Message: ERROR: null value in column “id” violates not-null constraint”
"Detail: Failing row contains (null, 2018-08-24 13:48:34.235-06, 2018-08-24 13:48:34.235-06, xxx, null, {“host”:“localhost”,“port”:2345,“dbname”:“desal_data-good”,“user…, postgres, f, t, null, null, 0 50 * * * ? *, 0 50 0 * * ? *, null, f, null).”
“SQLState: 23502”
“Error Code: 0”]}

08-24 13:48:40 e[1mDEBUG metabase.middlewaree[0m :: GET /api/database 200 (3 s) (3 DB calls). Jetty threads: 8/50 (6 busy, 6 idle, 0 queued)

And I get the same error trying to add a AWS Postgres DB, but no SSL error.
So right now seems I can not add a DB.

Yes exactly. They do the sane thing - no techie questions asked even for a noob user but a little confusing for someone used to see plenty of knobs until you know about this.

So, basically back to you can repro the problem :slight_smile:/:frowning_face: - and not linked to that the DB you add is on AWS. Guess next step is to simplify the special parts in your setup as I understood it. Meaning - what if your Metabase application DB is Postgres on AWS --> is Postgres locally --> is H2 locally. At what point will it then stop failing? Agree this would be a way to go about isolating - or got a better idea?

Thanks for the input, I’ll get back to this Monday.
I’m thinking something is borked in the metabase DB, I just don’t want to start clean and have to re enter all my queries.

Looked at the schema and a lot of FKs, so doubtful I could restore just the queries once I got the DBs into a new metabase DB.

If you know better, let me know.

Have a great weekend, and I’ll keep you posted

1 Like