No results from from mongo atlas

I'm trying to connect to my Mongo database hosted in mongo atlas cloud. But all I get is a blank page after the database is connected.
I tried another provider (Clever cloud) and it worked. The data is there.
Here is how I added the mongodb


Any Idea

Hi @iduoad
Which version of Metabase?
Do you see any errors/warnings in the Metabase log?
Did you follow the instructions outlined in the documentation?
https://www.metabase.com/docs/latest/administration-guide/databases/mongodb.html#connecting-to-a-mongodb-atlas-cluster

@iduoad
Does Heroku need to allow outgoing connections?
I’m guessing this is you on Github based on the same username:
https://github.com/metabase/metabase/issues/9867#issuecomment-538768263
Which makes me think that either the hostname is incorrect or Heroku cannot make DNS lookups for SRV records?

I had the SRV records problem locally and I managed to fix it.
Now that I moved to heroku. I have this new problem.
Metabase does not complain about SRV. the database is added succesfully but it's empty. like this

@iduoad
Then it sounds like you’re hitting this issue:
https://github.com/metabase/metabase/issues/10343

Yes, I think so. unfortunately there is no known workaround.
Thanks for your time.

I'm having the same issue, and have tried all recipes I can find online to connect to a MongoDB M10 Atlas cluster. I'm using v0.33.4, running the Metabase-provided Elastic Beanstalk application version, connected to Postgres on RDS. I'm getting errors in the log that look as follows -- though I'm not sure that's directly related, as these weren't happening the first times I tried adding the database connection:

[ba20c2fb-dbc8-4546-b30d-e3ca3109cd45] 2019-10-17T19:07:42-04:00 ERROR metabase.middleware.log GET /api/automagic-dashboards/database/5/candidates 500 7.3 ms (6 DB calls)
{:message "ERROR: syntax error at or near \"NULL\"\n Position: 84",
:type org.postgresql.util.PSQLException,
:stacktrace
("org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2440)"
"org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2183)"
"org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:308)"
"org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:441)"
"org.postgresql.jdbc.PgStatement.execute(PgStatement.java:365)"
"org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:143)"
"org.postgresql.jdbc.PgPreparedStatement.executeQuery(PgPreparedStatement.java:106)"
"com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewProxyPreparedStatement.java:431)"
.... TRUNCATED....
"middleware.misc$maybe_set_site_url$fn__47295.invoke(misc.clj:56)"
"middleware.misc$bind_user_locale$fn__47298.invoke(misc.clj:72)"
"middleware.misc$add_content_type$fn__47283.invoke(misc.clj:28)"
"middleware.misc$disable_streaming_buffering$fn__47306.invoke(misc.clj:87)"),
:sql-exception-chain ["PSQLException:" "Message: ERROR: syntax error at or near \"NULL\"" "Position: 84" "SQLState: 42601" "Error Code: 0"]}

This feels like the most vanilla Metabase installation possible, connecting to the most "vanilla" MongoDB installation possible, as Atlas has acquired mlab, consolidating the market. I think there's a strong business case to getting this working.

I'm currently trying a from-scratch reinstall to see if that helps.

@zzaacchh
This error looks to be when you’re viewing a X-ray dashboard.
What errors do you see, when you run a re-sync - similar to issue #10343, kinda no errors, but it’s just not finding any tables/columns when syncing?

Without knowing the entire query that RDS is choking on, it’s difficult to say what might be going on. Might be worth trying to get some more debug logging to see where it’s failing:
https://www.metabase.com/docs/latest/operations-guide/log-configuration.html

Thanks, @flamber. I just tried a from-scratch, every-detail-followed reinstall of Metabase on Beanstalk, followed the instructions on the Atlas install instructions, and am still getting no database schema to sync, after trying every conceivable permutation of configurations that I've seen others suggest in the various forum threads about tweaking the connection dialog.

Under the fresh install, I see pretty sparse logging after I try to coerce Metabase to rescan the schema:

[136c057f-ccbc-4ef7-8adf-33991555d3d0] 2019-10-17T20:33:08-04:00 INFO metabase.sync.util STARTING: Sync metadata for mongo Database 2 'MYDATABASE'
[136c057f-ccbc-4ef7-8adf-33991555d3d0] 2019-10-17T20:33:08-04:00 DEBUG metabase.middleware.log POST /api/database/2/sync_schema 200 7.6 ms (1 DB calls) Jetty threads: 3/50 (4 idle, 0 queued) (76 total active threads) Queries in flight: 0
[136c057f-ccbc-4ef7-8adf-33991555d3d0] 2019-10-17T20:33:08-04:00 INFO metabase.sync.util STARTING: step 'sync-timezone' for mongo Database 2 'MYDATABASE'
[136c057f-ccbc-4ef7-8adf-33991555d3d0] 2019-10-17T20:33:08-04:00 INFO metabase.sync.util FINISHED: step 'sync-timezone' for mongo Database 2 'MYDATABASE' (470.3 µs)
[136c057f-ccbc-4ef7-8adf-33991555d3d0] 2019-10-17T20:33:08-04:00 INFO metabase.sync.util STARTING: step 'sync-tables' for mongo Database 2 'MYDATABASE'
[136c057f-ccbc-4ef7-8adf-33991555d3d0] 2019-10-17T20:33:08-04:00 INFO metabase.sync.util FINISHED: step 'sync-tables' for mongo Database 2 'MYDATABASE' (63.1 ms)
[136c057f-ccbc-4ef7-8adf-33991555d3d0] 2019-10-17T20:33:08-04:00 INFO metabase.sync.util STARTING: step 'sync-fields' for mongo Database 2 'MYDATABASE'
[136c057f-ccbc-4ef7-8adf-33991555d3d0] 2019-10-17T20:33:08-04:00 INFO metabase.sync.util FINISHED: step 'sync-fields' for mongo Database 2 'MYDATABASE' (3.5 ms)
[136c057f-ccbc-4ef7-8adf-33991555d3d0] 2019-10-17T20:33:08-04:00 INFO metabase.sync.util STARTING: step 'sync-fks' for mongo Database 2 'MYDATABASE'
[136c057f-ccbc-4ef7-8adf-33991555d3d0] 2019-10-17T20:33:08-04:00 INFO metabase.sync.util FINISHED: step 'sync-fks' for mongo Database 2 'MYDATABASE' (2.9 ms)
[136c057f-ccbc-4ef7-8adf-33991555d3d0] 2019-10-17T20:33:08-04:00 INFO metabase.sync.util STARTING: step 'sync-metabase-metadata' for mongo Database 2 'MYDATABASE'
[136c057f-ccbc-4ef7-8adf-33991555d3d0] 2019-10-17T20:33:08-04:00 INFO metabase.sync.util FINISHED: step 'sync-metabase-metadata' for mongo Database 2 'MYDATABASE' (3.9 ms)
[136c057f-ccbc-4ef7-8adf-33991555d3d0] 2019-10-17T20:33:08-04:00 INFO metabase.sync.util FINISHED: Sync metadata for mongo Database 2 'MYDATABASE' (142.9 ms)
[136c057f-ccbc-4ef7-8adf-33991555d3d0] 2019-10-17T20:33:08-04:00 INFO metabase.sync.util STARTING: Analyze data for mongo Database 2 'MYDATABASE'
[136c057f-ccbc-4ef7-8adf-33991555d3d0] 2019-10-17T20:33:08-04:00 INFO metabase.sync.util STARTING: step 'fingerprint-fields' for mongo Database 2 'MYDATABASE'
[136c057f-ccbc-4ef7-8adf-33991555d3d0] 2019-10-17T20:33:08-04:00 INFO metabase.sync.util FINISHED: step 'fingerprint-fields' for mongo Database 2 'MYDATABASE' (2.2 ms)
[136c057f-ccbc-4ef7-8adf-33991555d3d0] 2019-10-17T20:33:08-04:00 INFO metabase.sync.util STARTING: step 'classify-fields' for mongo Database 2 'MYDATABASE'
[136c057f-ccbc-4ef7-8adf-33991555d3d0] 2019-10-17T20:33:08-04:00 INFO metabase.sync.util FINISHED: step 'classify-fields' for mongo Database 2 'MYDATABASE' (237.9 µs)
[136c057f-ccbc-4ef7-8adf-33991555d3d0] 2019-10-17T20:33:08-04:00 INFO metabase.sync.util FINISHED: step 'classify-tables' for mongo Database 2 'MYDATABASE' (342.5 µs)
[136c057f-ccbc-4ef7-8adf-33991555d3d0] 2019-10-17T20:33:08-04:00 INFO metabase.sync.util STARTING: step 'classify-tables' for mongo Database 2 'MYDATABASE'
[136c057f-ccbc-4ef7-8adf-33991555d3d0] 2019-10-17T20:33:08-04:00 INFO metabase.sync.util FINISHED: Analyze data for mongo Database 2 'MYDATABASE' (63.2 ms)
[136c057f-ccbc-4ef7-8adf-33991555d3d0] 2019-10-17T20:33:09-04:00 INFO metabase.sync.util STARTING: Cache field values in mongo Database 2 'MYDATABASE'
[136c057f-ccbc-4ef7-8adf-33991555d3d0] 2019-10-17T20:33:09-04:00 DEBUG metabase.middleware.log POST /api/database/2/rescan_values 200 5.9 ms (1 DB calls) Jetty threads: 3/50 (4 idle, 0 queued) (76 total active threads) Queries in flight: 0
[136c057f-ccbc-4ef7-8adf-33991555d3d0] 2019-10-17T20:33:09-04:00 INFO metabase.sync.util STARTING: step 'update-field-values' for mongo Database 2 'MYDATABASE'
[136c057f-ccbc-4ef7-8adf-33991555d3d0] 2019-10-17T20:33:09-04:00 INFO metabase.sync.util FINISHED: step 'update-field-values' for mongo Database 2 'MYDATABASE' (7.3 ms)
[136c057f-ccbc-4ef7-8adf-33991555d3d0] 2019-10-17T20:33:09-04:00 INFO metabase.sync.util FINISHED: Cache field values in mongo Database 2 'MYDATABASE' (38.3 ms)

I'll see if I can enable more detailed logging, by finding the right spot in the Beanstalk config to affect a change to the Log4j properties.

@zzaacchh
Another option is just to run Metabase locally on your computer, which will probably be easier to change the logging level than on EBS - and since it’s just a test, you can just use H2 as application database.
As for logging showing less on 0.33.4 is because (I think since 0.33.3) changed the level of several sync steps from debug to info, since there hadn’t been much sync problems since 0.32.0, where the verbose level was added.

That’s a good idea, @flamber. I’ll try that. Thanks!

I've run metabase locally, targeting my same Atlas M10 cluster, this time with Log4j DEBUG logging enabled. Getting the following truncated error message. Unfortunately, I'm not quite sure what this means. The metabase user I created on Atlas is an Admin, so I can't picture this user doesn't have enough credentials:

10-17 21:40:52 DEBUG middleware.log :: PUT /api/database/2 200 458.8 ms (4 DB calls) Jetty threads: 5/50 (2 idle, 0 queued) (67 total active threads) Queries in flight: 0
10-17 21:40:52 DEBUG middleware.log :: GET /api/database 200 2.8 ms (3 DB calls) Jetty threads: 5/50 (2 idle, 0 queued) (67 total active threads) Queries in flight: 0
10-17 21:41:00 DEBUG middleware.log :: POST /api/database/2/sync_schema 200 885.4 µs (1 DB calls) Jetty threads: 5/50 (2 idle, 0 queued) (67 total active threads) Queries in flight: 0
10-17 21:41:00 INFO sync.util :: STARTING: Sync metadata for mongo Database 2 'Uncooperative'
10-17 21:41:00 INFO sync.util :: STARTING: step 'sync-timezone' for mongo Database 2 'Uncooperative'
10-17 21:41:00 INFO sync.util :: FINISHED: step 'sync-timezone' for mongo Database 2 'Uncooperative' (243.6 µs)
10-17 21:41:00 INFO sync.util :: STARTING: step 'sync-tables' for mongo Database 2 'Uncooperative'
10-17 21:41:00 INFO sync-metadata.tables :: Found new tables: (Table 'system.users' Table 'system.version' Table 'system.keys' Table 'system.roles')
10-17 21:41:00 INFO sync-metadata.tables :: Updating description for tables: (Table 'system.users' Table 'system.version' Table 'system.keys' Table 'system.roles')
10-17 21:41:00 INFO sync.util :: FINISHED: step 'sync-tables' for mongo Database 2 'Uncooperative' (346.9 ms)
10-17 21:41:00 INFO sync.util :: STARTING: step 'sync-fields' for mongo Database 2 'Uncooperative'
10-17 21:41:00 ERROR driver.mongo :: Error introspecting collection: system.keys #error {
:cause Query failed with error code 13 and error message 'not authorized on admin to execute command { find: "system.keys", $db: "admin", $clusterTime: { clusterTime: Timestamp(1571362852, 1), signature: { hash: BinData(0, F6D61EC48D507A25BE7F88585E0D52DDE228AA90), keyId: 6747849726067998721 } }, lsid: { id: UUID("5fb7b44a-c109-4d1f-954c-b01acce7a11d") } }' on server ssi-server-cfbsa-shard-00-00-joztm.mongodb.net:27017
:via
[{:type com.mongodb.MongoQueryException
:message Query failed with error code 13 and error message 'not authorized on admin to execute command { find: "system.keys", $db: "admin", $clusterTime: { clusterTime: Timestamp(1571362852, 1), signature: { hash: BinData(0, F6D61EC48D507A25BE7F88585E0D52DDE228AA90), keyId: 6747849726067998721 } }, lsid: { id: UUID("5fb7b44a-c109-4d1f-954c-b01acce7a11d") } }' on server ssi-server-cfbsa-shard-00-00-joztm.mongodb.net:27017
:at [com.mongodb.operation.FindOperation$1 call FindOperation.java 707]}]
:trace
[[com.mongodb.operation.FindOperation$1 call FindOperation.java 707]
[com.mongodb.operation.FindOperation$1 call FindOperation.java 696]
[com.mongodb.operation.OperationHelper withConnectionSource OperationHelper.java 462]
[com.mongodb.operation.OperationHelper withConnection OperationHelper.java 406]
[com.mongodb.operation.FindOperation execute FindOperation.java 696]
[com.mongodb.operation.FindOperation execute FindOperation.java 83]
[com.mongodb.client.internal.MongoClientDelegate$DelegateOperationExecutor execute MongoClientDelegate.java 179]
[com.mongodb.client.internal.MongoClientDelegate$DelegateOperationExecutor execute MongoClientDelegate.java 161]
[com.mongodb.DBCursor initializeCursor DBCursor.java 963]
[com.mongodb.DBCursor hasNext DBCursor.java 149]

...

[java.util.concurrent.FutureTask run FutureTask.java 264]
[java.util.concurrent.ThreadPoolExecutor runWorker ThreadPoolExecutor.java 1128]
[java.util.concurrent.ThreadPoolExecutor$Worker run ThreadPoolExecutor.java 628]
[java.lang.Thread run Thread.java 830]]}
10-17 21:41:00 INFO sync.util :: FINISHED: step 'sync-fields' for mongo Database 2 'Uncooperative' (89.0 ms)
10-17 21:41:00 INFO sync.util :: STARTING: step 'sync-fks' for mongo Database 2 'Uncooperative'
10-17 21:41:00 INFO sync.util :: FINISHED: step 'sync-fks' for mongo Database 2 'Uncooperative' (1.5 ms)
10-17 21:41:00 INFO sync.util :: STARTING: step 'sync-metabase-metadata' for mongo Database 2 'Uncooperative'
10-17 21:41:00 INFO sync.util :: FINISHED: step 'sync-metabase-metadata' for mongo Database 2 'Uncooperative' (19.3 ms)
10-17 21:41:00 INFO sync.util :: FINISHED: Sync metadata for mongo Database 2 'Uncooperative' (539.3 ms)
10-17 21:41:00 INFO sync.util :: STARTING: Analyze data for mongo Database 2 'Uncooperative'
10-17 21:41:00 INFO sync.util :: STARTING: step 'fingerprint-fields' for mongo Database 2 'Uncooperative'
10-17 21:41:00 INFO sync.analyze :: fingerprint-fields Analyzed [···········································] :disappointed: 15% Table 8 'system.roles'
10-17 21:41:00 INFO sync.analyze :: fingerprint-fields Analyzed [
···································] :confused: 31% Table 6 'system.version'
10-17 21:41:00 INFO sync.util :: FINISHED: step 'fingerprint-fields' for mongo Database 2 'Uncooperative' (5.3 ms)
10-17 21:41:00 INFO sync.util :: STARTING: step 'classify-fields' for mongo Database 2 'Uncooperative'
10-17 21:41:00 INFO sync.analyze :: classify-fields Analyzed [
···························] :grimacing: 46% Table 8 'system.roles'
10-17 21:41:00 INFO sync.analyze :: classify-fields Analyzed [
····················] :relieved: 62% Table 6 'system.version'
10-17 21:41:00 INFO sync.util :: FINISHED: step 'classify-fields' for mongo Database 2 'Uncooperative' (1.7 ms)
10-17 21:41:00 INFO sync.util :: STARTING: step 'classify-tables' for mongo Database 2 'Uncooperative'
10-17 21:41:00 INFO sync.analyze :: classify-tables Analyzed [
***********************············] :yum: 77% Table 8 'system.roles'
10-17 21:41:00 INFO sync.analyze :: classify-tables Analyzed [**********************************************····] :heart_eyes: 92% Table 6 'system.version'
10-17 21:41:00 INFO sync.util :: FINISHED: step 'classify-tables' for mongo Database 2 'Uncooperative' (1.8 ms)
10-17 21:41:00 INFO sync.util :: FINISHED: Analyze data for mongo Database 2 'Uncooperative' (145.2 ms)
10-17 21:41:02 DEBUG middleware.log :: POST /api/database/2/rescan_values 200 932.9 µs (1 DB calls) Jetty threads: 5/50 (2 idle, 0 queued) (67 total active threads) Queries in flight: 0
10-17 21:41:02 INFO sync.util :: STARTING: Cache field values in mongo Database 2 'Uncooperative'
10-17 21:41:02 INFO sync.util :: STARTING: step 'update-field-values' for mongo Database 2 'Uncooperative'
10-17 21:41:02 INFO sync.util :: FINISHED: step 'update-field-values' for mongo Database 2 'Uncooperative' (607.9 ms)
10-17 21:41:02 INFO sync.util :: FINISHED: Cache field values in mongo Database 2 'Uncooperative' (684.0 ms)

@zzaacchh
And you’re using AuthenticationDatabase : admin as configuration?
Every search I’m doing on that, say that’s the problem:
https://stackoverflow.com/questions/23943651/mongodb-admin-user-not-authorized

I would actually recommend that you add this log as a comment on the issue, since I think the error you’re seeing might be why it’s failing the sync, but I have very little knowledge about MongoDB/Atlas.

@flamber . When I try removing AuthenticationDatabase: admin from the configuration, the sync completes with no errors, but then I get an empty database schema :frowning:

@zzaacchh Hmmm…and no warnings or anything to give a hint why it’s not getting any data? I still think you should add that detail to issue, since it seems like that’s the AuthenticationDatabase : admin configuration is what is recommended in the documentation (from what I can understand) and the docs have just been revamped, so they should be correct.