Error: The database is read only (unable to connect me) #12780

Hi,

Metabase is setup on ElasticBeanStalk and it was working fine but since yesterday, I can't connect me to the interface.

When I try to loggin me, an error appears on the below call:

[POST] - https://domain.com/api/session/google_auth
{
"message": "The database is read only; SQL statement:\nINSERT INTO "CORE_SESSION" ("ID", "USER_ID", "CREATED_AT") VALUES (?, 1, now()) [90097-197]",
"type": "class org.h2.jdbc.JdbcSQLException",
"stacktrace": ["org.h2.message.DbException.getJdbcSQLException(DbException.java:357)", "org.h2.message.DbException.get(DbException.java:179)", "org.h2.message.DbException.get(DbException.java:155)", "org.h2.message.DbException.get(DbException.java:144)", "org.h2.engine.Database.checkWritingAllowed(Database.java:1989)", "org.h2.table.Table.checkWritingAllowed(Table.java:1201)", "org.h2.engine.User.hasRight(User.java:114)", "org.h2.engine.User.checkRight(User.java:100)", "org.h2.command.dml.Insert.insertRows(Insert.java:143)", "org.h2.command.dml.Insert.update(Insert.java:134)", "org.h2.command.CommandContainer.update(CommandContainer.java:102)", "org.h2.command.Command.executeUpdate(Command.java:261)", "org.h2.jdbc.JdbcPreparedStatement.executeUpdateInternal(JdbcPreparedStatement.java:199)", "org.h2.jdbc.JdbcPreparedStatement.executeUpdate(JdbcPreparedStatement.java:153)", "com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate(NewProxyPreparedStatement.java:462)", "clojure.java.jdbc$db_do_execute_prepared_return_keys$exec_and_return_keys__18654.invoke(jdbc.clj:961)", "clojure.java.jdbc$db_do_execute_prepared_return_keys.invokeStatic(jdbc.clj:989)", "clojure.java.jdbc$db_do_execute_prepared_return_keys.invoke(jdbc.clj:945)", "clojure.java.jdbc$db_do_prepared_return_keys.invokeStatic(jdbc.clj:1020)", "clojure.java.jdbc$db_do_prepared_return_keys.invoke(jdbc.clj:997)", "clojure.java.jdbc$db_do_prepared_return_keys.invokeStatic(jdbc.clj:1022)", "clojure.java.jdbc$db_do_prepared_return_keys.invoke(jdbc.clj:997)", "toucan.db$simple_insert_many_BANG_$iter__21137__21141$fn__21142$fn__21143.invoke(db.clj:560)", "toucan.db$simple_insert_many_BANG_$iter__21137__21141$fn__21142.invoke(db.clj:558)", "clojure.lang.LazySeq.sval(LazySeq.java:42)", "clojure.lang.LazySeq.seq(LazySeq.java:51)", "clojure.lang.RT.seq(RT.java:535)", "clojure.core$seq__5402.invokeStatic(core.clj:137)", "clojure.core$dorun.invokeStatic(core.clj:3133)", "clojure.core$doall.invokeStatic(core.clj:3148)", "clojure.core$doall.invoke(core.clj:3148)", "toucan.db$simple_insert_many_BANG_.invokeStatic(db.clj:557)", "toucan.db$simple_insert_many_BANG_.invoke(db.clj:543)", "toucan.db$simple_insert_BANG_.invokeStatic(db.clj:590)", "toucan.db$simple_insert_BANG_.invoke(db.clj:579)", "toucan.db$insert_BANG_.invokeStatic(db.clj:607)", "toucan.db$insert_BANG_.invoke(db.clj:594)", "toucan.db$insert_BANG_.invokeStatic(db.clj:610)", "toucan.db$insert_BANG_.doInvoke(db.clj:594)", "clojure.lang.RestFn.invoke(RestFn.java:494)", "--> api.session$fn__64123$create_session_BANG___64116__64128$fn__64129.invoke(session.clj:46)", "api.session$fn__64123$create_session_BANG___64116__64128.invoke(session.clj:43)", "api.session$fn__64341$google_auth_fetch_or_create_user_BANG___64346$fn__64347.invoke(session.clj:308)", "api.session$fn__64341$google_auth_fetch_or_create_user_BANG___64346.invoke(session.clj:302)", "api.session$do_google_auth.invokeStatic(session.clj:314)", "api.session$do_google_auth.invoke(session.clj:310)", "api.session$fn__64367$fn__64370$fn__64371.invoke(session.clj:329)", "api.session$fn__64367$fn__64370.invoke(session.clj:328)", "api.session$do_http_400_on_error.invokeStatic(session.clj:131)", "api.session$do_http_400_on_error.invoke(session.clj:129)", "api.session$fn__64367.invokeStatic(session.clj:327)", "api.session$fn__64367.invoke(session.clj:318)", "routes$fn__67541$fn__67542.doInvoke(routes.clj:56)", "middleware.exceptions$catch_uncaught_exceptions$fn__66286.invoke(exceptions.clj:97)", "middleware.exceptions$catch_api_exceptions$fn__66283.invoke(exceptions.clj:85)", "middleware.log$log_api_call$fn__67917$fn__67918.invoke(log.clj:178)", "middleware.log$log_api_call$fn__67917.invoke(log.clj:172)", "middleware.security$add_security_headers$fn__66249.invoke(security.clj:121)", "middleware.json$wrap_json_body$fn__67622.invoke(json.clj:64)", "middleware.json$wrap_streamed_json_response$fn__67640.invoke(json.clj:100)", "middleware.misc$maybe_set_site_url$fn__67946.invoke(misc.clj:58)", "middleware.session$bind_current_user$fn__62772$fn__62773.invoke(session.clj:209)", "middleware.session$do_with_current_user.invokeStatic(session.clj:184)", "middleware.session$do_with_current_user.invoke(session.clj:177)", "middleware.session$bind_current_user$fn__62772.invoke(session.clj:208)", "middleware.session$wrap_current_user_id$fn__62757.invoke(session.clj:161)", "middleware.session$wrap_session_id$fn__62701.invoke(session.clj:125)", "middleware.auth$wrap_api_key$fn__66195.invoke(auth.clj:27)", "middleware.misc$bind_user_locale$fn__67949.invoke(misc.clj:74)", "middleware.misc$add_content_type$fn__67932.invoke(misc.clj:29)", "middleware.misc$disable_streaming_buffering$fn__67957.invoke(misc.clj:89)"],
"sql-exception-chain": ["JdbcSQLException:", "Message: The database is read only; SQL statement:", "INSERT INTO "CORE_SESSION" ("ID", "USER_ID", "CREATED_AT") VALUES (?, 1, now()) [90097-197]", "SQLState: 90097", "Error Code: 90097"]
}

Nothing has been done on the machine, we don't know what happened...

:point_right: Is anyone know how to fix that?

Hi @simonrobain
Which version of Metabase?
How did you set it up? It looks like you’re using H2, which is not recommended, specially on EBS.
Have you tried restarting the EBS?
Make sure you have backups of the instance.

{
“browser-info”: {
“language”: “fr-FR”,
“platform”: “MacIntel”,
“userAgent”: “Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36”,
“vendor”: “Google Inc.”
},
“system-info”: {
“java.runtime.name”: “OpenJDK Runtime Environment”,
“java.runtime.version”: “11.0.5+10”,
“java.vendor”: “AdoptOpenJDK”,
“java.vendor.url”: “https://adoptopenjdk.net/”,
“java.version”: “11.0.5”,
“java.vm.name”: “OpenJDK 64-Bit Server VM”,
“java.vm.version”: “11.0.5+10”,
“os.name”: “Linux”,
“os.version”: “4.14.165-103.209.amzn1.x86_64”,
“user.language”: “en”,
“user.timezone”: “GMT”
},
“metabase-info”: {
“databases”: [
“postgres”,
“googleanalytics”
],
“hosting-env”: “unknown”,
“application-database”: “h2”,
“application-database-details”: {
“database”: {
“name”: “H2”,
“version”: “1.4.197 (2018-03-18)”
},
“jdbc-driver”: {
“name”: “H2 JDBC Driver”,
“version”: “1.4.197 (2018-03-18)”
}
},
“run-mode”: “prod”,
“version”: {
“date”: “2020-02-25”,
“tag”: “v0.34.3”,
“branch”: “release-0.34.x”,
“hash”: “1a83edb”
},
“settings”: {
“report-timezone”: “Europe/Berlin”
}
}
}

@simonrobain
Migrate away from H2 - that will likely fix all your problems:
https://www.metabase.com/docs/latest/operations-guide/migrating-from-h2.html
And latest release is 0.35.4