I worked up a minimal example using Prisma and the Apollo Server stack. This example will catch write errors to Postgres in regions with read replica, then replay the request in the primary Postgres region.
This approach is generally way more efficient than writing to the database over the network, as the latter will suffer from latency. While this approach is naive, you could easily modify this to replay all mutations automatically, as mentioned above. I’ll be looking into ways to do that. For now, this may suffice for testing purposes.
What you’ll want to test properly is whether you see replication lag in your UI. For example, you might create a product and redirect a user to a ‘product view’ page. That product data may not have arrived in the replica. There are various ways to solve this, like setting a cookie. We can discuss as things progress.
There are no doubt other edge cases to consider, so do bring them up here.