ERROR: cannot execute nextval() in a read-only transaction

I have this “ERROR: cannot execute nextval() in a read-only transaction”, using an application with spring and the AWS Aurora database. We have two environments READING and WRITING, I am receiving this error even when executing a method in the writing database. The method in question is a generic save, coming from the CrudRepository.class class. Link used to assemble the dataSource structure: https://masteranyfield.com/2021/09/29/spring-boot-aws-aurora-mysql-read-write-segregation/. I’ve already tried using spring’s @Transactional too.

I am trying to use a save but the error does not allow me to continue the application.

  • 1

    Please provide enough code so others can better understand or reproduce the problem.

    – 
    Bot

Leave a Comment