question

cardinaluk-5293 avatar image
0 Votes"
cardinaluk-5293 asked Jerryzy commented

Getting The service worker navigation preload request was cancelled before 'preloadResponse' settled. If you intend to use 'preloadResponse', use waitUntil() or respondWith() to wait for the promise to settle.

I'm getting the error:
The service worker navigation preload request was cancelled before 'preloadResponse' settled. If you intend to use 'preloadResponse', use waitUntil() or respondWith() to wait for the promise to settle.
When using:

 private _jeSelectPermission = async () => {
     try{
     const ler = await sp.web.lists.ensure("MyList");
     const list: IList = ler.list;
    
     await list.roleAssignments();
     const user = await sp.web.currentUser();
    
     const ReadroleDefinition = await sp.web.roleDefinitions.getByName("Read").get();
    console.log("roleDefinition : ", ReadroleDefinition);
        
   //  await sp.web.lists.getByTitle('MyList').items.getById(this.state.JEId).breakRoleInheritance(true);
        
    await sp.web.lists.getByTitle('MyList').items.getById(this.state.JEId).roleAssignments.add(user.Id, ReadroleDefinition.Id);
    const info = await sp.web.lists.getByTitle('MyList').items.getById(this.state.JEId).roleAssignments(); 
    console.log(info);
     } catch(error){
       console.log(error);
     }
        
   }

It works initially, so if I set permissions onto several items one by one, it works, but then starts to show these errors. Any ideas?




office-sharepoint-server-development
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @cardinaluk-5293 ,

Is there any updates ? Did the suggestion solve the problem ?

1 Vote 1 ·

1 Answer

Jerryzy avatar image
1 Vote"
Jerryzy answered

Hi @cardinaluk-5293 ,

The code snippet works in my side based on my testing.

And the error "The service worker navigation preload request was cancelled before 'preloadResponse' settled. If you intend to use 'preloadResponse', use waitUntil() or respondWith() to wait for the promise to settle." should be related to Google Chrome Service Workers, it's not because of PnP Request, please check the same error here:

The service worker navigation preload request



If an Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.