pnp / pnpjs

Fluent JavaScript API for SharePoint and Microsoft Graph REST APIs
https://pnp.github.io/pnpjs/
Other
762 stars 304 forks source link

Calls wait endless since 3.21.0 (updated from 3.20.0) #2890

Closed dvTB closed 9 months ago

dvTB commented 10 months ago

Major Version

3.x

Minor Version Number

21.0

Target environment

NodeJS

Additional environment details

Running a multi-tenant service using msal authentication on Node 20 with express.

Expected or Desired Behavior

Calls should get answered and not wait indefinitly until timeout is reached.

Observed Behavior

When updating from 3.20.0 to 3.21.0 my service no longer responds because sporadically some promises from pnp.js just don't get answered (or would fail). So far the only soltion I found is going back to 3.20.0

Now also tried 3.20.1 which also works.

Steps to Reproduce

So far I couldn't pinpoint the location of the problem. It just happens sporadic on different calls (getting web, site, items, list, ...).

patrick-rodgers commented 10 months ago

@dvTB - can you share some more details? We aren't aware of a change that would affect this - unless perhaps you are using caching? If so, can you remove it and see if that resolves the issue?

Can you perhaps share an example of code that is having sporadic issues? With what you've shared we aren't sure where to start looking.

allanhvam commented 10 months ago

I am also seeing some strange behavior with the latest version.

This works:

await sp.web.lists.getByTitle("Title")()

But:

await sp.web.lists.getByTitle("Title").items()

seems to never return.

From by debugging it seems to never get past the new emit rawData: https://github.com/pnp/pnpjs/blob/d96c7be519e8588716ab0d9b10072601f10a5aac/packages/queryable/queryable.ts#L184

(but I could be wrong)

I am not using any caching behavior, and I am on NodeJS v16.

bcameron1231 commented 10 months ago

Hi. I am having trouble reproducing. I have ran through an items() call a few hundred times and it's worked every time. I've set up a loop and ran this a few times, and the output has always been the same.

   const listname = 'SPFx List';       
            for(var i = 0; i< 20; i++){
                const items = await sp.web.lists.getByTitle(listname).items();
                console.log(i + " - " + items.length);
            }

image

Are you seeing any errors any where in console? Could you give us a little information about your list, is this happening on every list? Is it possible to share a non-working solution that we can test with?

In the meantime, I'll continue testing. I'm wondering if it's a node specific issue happening.

bcameron1231 commented 10 months ago

Quick update. I was able to reproduce on node. Will keep you posted.

The issue appears to be the use of clone() when responses are larger than 16KB, as streams in nodejs have a smaller internal buffer sizes than browsers, and thus it hangs.

github-actions[bot] commented 9 months ago

This issue is locked for inactivity or age. If you have a related issue please open a new issue and reference this one. Closed issues are not tracked.