I found the issue,
let instituteUser = await this.instituteUsersRepository.findOneBy({id: 1});
instituteUser.updated_at = new Date().toISOString()
await this.instituteUsersRepository.save(instituteUser) // Works OK
await this.instituteUsersRepository.update({ id: 1 }, { updated_at: new Date().toISOString() }); // Works OK
await instituteUser.save(); // Throws Error
The issue does not happen consistently. Sometimes, when I start the app, entity.save() works fine. Other times, it fails with the read-only transaction error.
This makes me suspect it depends on: Order of connection initialization or which connection is resolved at runtime
Anyway, solved it by changing the save function.