In case you're going crazy trying to debug this error message (as I was), it turned out I was using a foreign data wrapper to another database that had a much lower setting for idle_in_transaction_session_timeout.