When the standby server receives updates/deletes in the WAL stream that will result in invalidating data currently being accessed by a running query, this error will happen. Read More
Suggested Solutions:
Set hot_standby_feedback = on on the standby. This will pass a message to the Primary server that some rows are still required in a table. It will allow queries on the Secondary replica to be completed, but it will cause bloat in the Primary.
Increase max_standby_archive_delay / max_standby_streaming_delay. This will allow the queries to finish as well by allowing the standby server to purposely augment replication lag.
Otherwise, since you can also try to resubmit the queries, you may be okay with those queries being canceled sometimes.