Please specify what version of the library you are using: [ stable ]
Please specify what version(s) of SharePoint you are targeting: [ no idea, something on-premise ]
I am encountering hanging sharepoint calls, the debugging just shows things like
[d8b3b767-47ec-473c-8d5c-5ba85d7de95c] (1564999842003) Beginning GET request (https://$sharepointsite/_api/web/lists('88129a04-aafb-4b37-a6da-874c0255ed4a')/items(36)/folder/parentFolder/listItemAllFields)
[d8b3b767-47ec-473c-8d5c-5ba85d7de95c] (1564999842003) Sending request.
and then nothing. I'm assuming there's some network issue, but shouldn't this call time out?
Is there a way to pass a timeout? Or would I have to pass a custom fetch client?
Network issues would produce an error. When I see this behavior it is often that I have made a request and not awaited it. Can you provide a repo we can review that demonstrates this behavior?
I'm sorry, I tracked this down to most likely a network layer issue, and forgot to close this.
The code fails intermittently, so it works, and the problem is definitely network related. For example, here I'm trying to determine the parent folder of an item:
// ...
if (!parentItem) {
// ask SP about the parent
const spFolder = list.items.getById(id).folder
parentItem = await spFolder.parentFolder.getItem()
}
// Urgh
if (parentItem.Id && !(parentItem.Title || parentItem.Name)) {
const folder = await parentItem.folder.get()
parentItem.Title = folder.Name
}
This code needs to work with on-premise SP 2013.
What happens is that sometimes a request goes out and the response is dropped somewhere along the way without closing the TCP stream, and the requests just hang.
I provided my own fetch that does some logging and adds timeouts and retries, and for GET queries I'm able to retry, but of course for POST queries I'm just at the mercy of the network layer.
While setting this up I did accidentally create an infinite loop of fetches, which were allowed to go up to 50 deep before hanging in the same way. I'm guessing I'm hitting some sort of DoS mitigation maybe. I tried throttling my requests to 0.5/s but that doesn't help.
What do you think? Definitely network along the way, right?
If the fetch implementation doesn't give us anything back, which seems to be the case here, we don't do anything. We don't currently wait for a timeout since those cases are rare, but we are then at the mercy of the fetch implementation either in the browser or node and how they handle these conditions. IMO not a lot we can do in cases like this.
Right. I suppose it would be nice if there was at least a timeout, but I was able to add it myself on top of sp-auth. I'll closer
Most helpful comment
If the fetch implementation doesn't give us anything back, which seems to be the case here, we don't do anything. We don't currently wait for a timeout since those cases are rare, but we are then at the mercy of the fetch implementation either in the browser or node and how they handle these conditions. IMO not a lot we can do in cases like this.