Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when running a SpringBoot application in AWS Lambda #1118

Open
utibeng opened this issue Feb 29, 2024 · 1 comment
Open

Error when running a SpringBoot application in AWS Lambda #1118

utibeng opened this issue Feb 29, 2024 · 1 comment

Comments

@utibeng
Copy link

utibeng commented Feb 29, 2024

Versions: spring-cloud-function-adapter-aws 4.1.0. Java 19.

When I run a Spring Boot application in AWS lambda connecting to a postgress AWS RDS database, I get the error below:

{
"errorMessage": "Error creating bean with name 'batchDataSourceInitializer' defined in class path resource [org/springframework/boot/autoconfigure/batch/BatchAutoConfiguration$DataSourceInitializerConfiguration.class]: Failed to instantiate [org.springframework.boot.autoconfigure.batch.BatchDataSourceScriptDatabaseInitializer]: Factory method 'batchDataSourceInitializer' threw exception with message: Unable to detect database type",
"errorType": "org.springframework.beans.factory.BeanCreationException"
} .

I have applications.properties with the following:
spring.datasource.url=jdbc:postgresql://XXX.rds.amazonaws.com:5432/postgres
spring.datasource.jdbcUrl=${spring.datasource.url}
spring.datasource.username=XXX
spring.datasource.password=XXX
spring.datasource.driver-class-name=org.postgresql.Driver

I have followed AWS guidance to set up the Lambda RDS connection including the RDS proxy, roles, etc

The application runs seamlessly on-prem, we are attempting to convert to serverless with AWS Lambda
I have successfully ran Spring Boot applications in lambda, without database connections. In fact, this error occurs when Hikari database connection pool is being initialised

Is there an example of using Spring Boot, AWS Lambda and a database connection? There isn't any currently in the examples

@olegz olegz added the AWS label Mar 27, 2024
@olegz
Copy link
Contributor

olegz commented Mar 27, 2024

Given it is a first request related to connecting to AWS RDS database, can you please include the working version running locally with some in-memory DB and commented properties related to AWS RDS so we can work on it.
For the record we have not tested it with AWS RDS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants