Pnpjs: TypeError: "NetworkError when attempting to fetch resource."

Created on 17 Dec 2018  路  5Comments  路  Source: pnp/pnpjs

Category

  • [ ] Enhancement
  • [ ] Bug
  • [X] Question
  • [ ] Documentation gap/issue

Version

Please specify what version of the library you are using: [ fetch.min.js version 2.0.3 and es6-promise.auto.js version 4.0.5 and pnp.min.js version 2.0.5 ]

Please specify what version(s) of SharePoint you are targeting: [ Sharepoint 2013 / On Perm / Service Pack 1 ]

Expected / Desired Behavior / Question

I try to update a custom list's item using code below
Everything works fine in IE and Chrome browsers but in Firefox (all versions), that doesn't update my selected item

` $("#s2-hr-reg").click(function(){
if( $("#dd-hr-check option:selected").val() != "毓丿賲 丕賳鬲禺丕亘" ){
$("#second-step-wrn").hide();
$pnp.sp.web.lists.getById("FAEF76D1-BAAB-47B2-AEFF-CC78F819C891").items.getById(parseInt(id)).update({
field31: $("#dd-hr-check").val(),
Desc12: $("#txt-hr-description").val(),
field32: $("#dd-hr-expert").val(),
CurrentState: _statusFlag,
AssignToId: _assign
}).then(function(items){
console.log(items);
$("#second-step-frm").show();
showAlertMessage().done(function(){
closeWindow();
})

            }).catch(function(e){
                console.log(e);
            })                  
        }else{
            $("#second-step-wrn").show();
            return false;
        }       


    })`

I encountered with below error in mozilla firefox

Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user鈥檚 experience. For more help http://xhr.spec.whatwg.org/ init.js:1:48659
TypeError: "NetworkError when attempting to fetch resource."

How can I fix it ?
error

code answered question

Most helpful comment

Looks like something unrelated to the library but FireFox and Fetch specific.
Did you try the same without polyfills in FF?
Did you try if any raw Fetch requests works?

All 5 comments

Looks like something unrelated to the library but FireFox and Fetch specific.
Did you try the same without polyfills in FF?
Did you try if any raw Fetch requests works?

I didn't try the same without polyfills in FF But I'll try and tell that result.

Yes I try raw Fetch requests and It works properly ( I attached screen shots ) .

chrome-fr
mozila-fr
chrome

Dear @koltyakov , When I try the same without polyfills in FF nothing gonna happen . I got same results.
Can you guess what's wrong ??

Hard to say, PnPjs works for me in FF just well. This is definitely something outside the library or a setup specific. There are a lot of references to TypeError: "NetworkError when attempting to fetch resource." & FF over the internet. Some of them saying that the issue is related to CORS. Can it be that your code is executed outside SharePoint domain?

Going to close this as answered. If you need to continue the conversation please _reopen_ the issue. Thanks!

Was this page helpful?
0 / 5 - 0 ratings