I am getting the following errors when trying to get list of items from SharePoint online using PnP-PowerShell:
Get-PnPListItem : The underlying connection was closed: A connection that was expected to be kept alive was closed by the server.
Get-PnPListItem : Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.
This seems to happen when the List of items I am trying to retrieve is large. It might be a timeout error but I am not sure how to fix it. Looking online most people are suggesting updating TLS [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12;
but I am not sure if it will help if it is timeout issue.