This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-03-31
Channels
- # announcements (5)
- # babashka (5)
- # beginners (24)
- # calva (21)
- # cherry (1)
- # clerk (20)
- # clj-kondo (3)
- # clj-otel (12)
- # clojure (50)
- # clojure-austin (2)
- # clojure-conj (3)
- # clojure-europe (40)
- # clojure-nl (1)
- # clojure-norway (203)
- # clojure-spec (3)
- # clojure-uk (6)
- # clojurescript (8)
- # conjure (1)
- # datomic (1)
- # deps-new (1)
- # emacs (5)
- # graphql (8)
- # gratitude (5)
- # holy-lambda (16)
- # honeysql (18)
- # hyperfiddle (12)
- # java (1)
- # jobs (1)
- # lsp (24)
- # membrane (8)
- # nbb (1)
- # off-topic (19)
- # portal (28)
- # proletarian (11)
- # rdf (63)
- # re-frame (38)
- # reagent (8)
- # reitit (1)
- # releases (6)
- # remote-jobs (1)
- # scittle (4)
- # shadow-cljs (20)
- # spacemacs (4)
- # sql (7)
- # transit (1)
Has anyone created a (native backend) holy-lambda function that connets to an RDS Mysql database?
I keep getting this error... (db hostname edited to avoid leaking 🙂 )
{:type com.zaxxer.hikari.pool.HikariPool$PoolInitializationException, :message "Failed to initialize pool: Cannot connect to MySQL server on
not sure if I've forgotten some dependencies or something else is going on. The same code and config works perfectly on my machine, but doens't work when using sam local invoke
or when running in Lambda.
same RDS database, same credentials
Do you have all the permissions set on Lambda?
yes I was about to write that, VPC, security groups, and the execution role allowing VPC access are all set
I wonder if these extra stack trace elements might help...
[com.mysql.cj.jdbc.*exceptions*.SQLError createSQLException "SQLError.java" 110]} {:type java.lang.ClassCastException, :message "com.mysql.cj.*exceptions*.CJException cannot be cast to com.mysql.cj.*exceptions*.UnableToConnectException", :at [com.mysql.cj.jdbc.ConnectionImpl createNewIO "ConnectionImpl.java" 825]}], :trace [[com.mysql.cj.jdbc.ConnectionImpl createNewIO "ConnectionImpl.java" 825] [com.mysql.cj.jdbc.ConnectionImpl <init> "ConnectionImpl.java" 448] [com.mysql.cj.jdbc.ConnectionImpl getInstance "ConnectionImpl.java" 241] [com.mysql.cj.jdbc.NonRegisteringDriver connect "NonRegisteringDriver.java" 198] [com.zaxxer.hikari.util.DriverDataSource getConnection "DriverDataSource.java" 121] [com.zaxxer.hikari.pool.PoolBase newConnection "PoolBase.java" 358] [com.zaxxer.hikari.pool.PoolBase newPoolEntry "PoolBase.java" 206] [com.zaxxer.hikari.pool.HikariPool createPoolEntry "HikariPool.java" 477] [com.zaxxer.hikari.pool.HikariPool checkFailFast "HikariPool.java" 560] [com.zaxxer.hikari.pool.HikariPool <init> "HikariPool.java" 115] [com.zaxxer.hikari.HikariDataSource <init> "HikariDataSource.java" 81] [hikari_cp.core$make_datasource invokeStatic "core.clj" 265]
the part that gets me is that this happens on AWS Lambda or in sam local invoke
, so I don't think it's about security groups or IAM roles or VPCs or anything of the sorts...
the same code/configuration works when I invoke it directly at the repl or in a test
Btw, why you want to use hikari for Lambda? Connection pool doesnt make sense for Lambda environment.
hmmm it's not a matter of "want" but a matter of "copy pasting my code from other applications to use mysql in this one" 😉
Ok, just for your information using connection pool is risky. You will quickly kill the connection limit.
I would try without Hikari.
okay, after ripping out conman (which was bringing in Hikari) and simplifying a few things, sam local invoke
is now working properly. Deploying now to Lambda, fingers crossed.. but already very promising ,thanks for the tip @UJ1339K2B!
confirmed, DB connection is now working in Lambda as well! can't say "thanks" enough @UJ1339K2B 🙂