locked
CORS REST Requests: SP.RequestExecutor Returning Error RRS feed

  • Question

  • I created a primitive form to test CORS requests. The HTML file contains the script element to load the SP.RequestExecutor.js file (this form works inside an aspx SP chrome file or outside of it).

    I am doing a simple GET on a PDF at the remote site (which happens to be a sharepoint.com site), and following the script action in Chrome. The Chrome console shows the following output below. I reformatted it to show a line number to the left with the file and line # executing, then inserting an indented line below that shows the message. Identifying URLs were also changed to not show real URLs, although the "sharepoint.com" domain is correct.

    01	CORSTestRESTRequests.html:198 
    				appweb url = https://vendorsharepoint.sharepoint.com
    02	SP.RequestExecutor.js:2  
    				:The frame element does not exist. Put request in queue
    03	SP.RequestExecutor.js:2  
    				:Created IFrame https://vendorsharepoint.sharepoint.com/_layouts/15/AppWebProxy.aspx?SP.AppPageUrl=https://divisiongroup/SiteAssets/CORSTestRESTRequests.html
    04	SP.RequestExecutor.js:2  
    				:Create IFrameLoadTimeout 2
    05	CORSTestRESTRequests.html:322 
    				[Violation] 'click' handler took 3187ms
    06	CORSTestRESTRequests.html:1 
    				A cookie associated with a cross-site resource at http://vendorsharepoint.sharepoint.com/ was set without the `SameSite` attribute. A future release of Chrome will only deliver cookies with cross-site requests if they are set with `SameSite=None` and `Secure`. You can review cookies in developer tools under Application>Storage>Cookies and see more details at https://www.chromestatus.com/feature/5088147346030592 and https://www.chromestatus.com/feature/5633521622188032.
    07	SP.RequestExecutor.js:2  
    				:Processing IFRAME onload event
    08	SP.RequestExecutor.js:2  
    				:Clear IFrameLoadTimeout 2
    09	SP.RequestExecutor.js:2  
    				:Start to ping the IFRAME https://vendorsharepoint.sharepoint.com/_layouts/15/AppWebProxy.aspx
    10	SP.RequestExecutor.js:2  
    				:Create IFramePingTimeout 3
    11	SP.RequestExecutor.js:2  
    				:RequestExecutor.PostMessage.Message: {"command":"Ping","postMessageId":"SP.RequestExecutor2"}
    12	SP.RequestExecutor.js:2  
    				:RequestExecutor.PostMessage.Target: https://vendorsharepoint.sharepoint.com/_layouts/15/AppWebProxy.aspx
    13	AppWebProxy.aspx?SP.AppPageUrl=https://divisiongroup/SiteAssets/CORSTestRESTRequests.html:201 
    				ErrorPage.OnMessage: Origin=https://divisiongroup, Data={"command":"Ping","postMessageId":"SP.RequestExecutor2"}
    14	AppWebProxy.aspx?SP.AppPageUrl=https://divisiongroup/SiteAssets/CORSTestRESTRequests.html:231 
    				ErrorPage.PostMessage: Origin=https://divisiongroup, Data={"command":"Ping","postMessageId":"SP.RequestExecutor2","responseAvailable":false,"errorCode":-1007,"errorMessage":"Correlation ID: 6f842b9f-b0ca-a000-ef66-88b16d4445ad"}
    15	SP.RequestExecutor.js:2  
    				:RequestExecutor.OnMessage
    16	SP.RequestExecutor.js:2  
    				:RequestExecutor.OnMessage: Message.data={"command":"Ping","postMessageId":"SP.RequestExecutor2","responseAvailable":false,"errorCode":-1007,"errorMessage":"Correlation ID: 6f842b9f-b0ca-a000-ef66-88b16d4445ad"}
    17	SP.RequestExecutor.js:2  
    				:RequestExecutor.OnMessage: Message.origin=https://vendorsharepoint.sharepoint.com
    18	SP.RequestExecutor.js:2  
    				:Successfully load frame for https://vendorsharepoint.sharepoint.com/_layouts/15/AppWebProxy.aspx
    19	SP.RequestExecutor.js:2  
    				:RequestExecutor.PostMessage.Message: {"command":"Query","url":"https://vendorsharepoint.sharepoint.com/:b:/r/Corres/Submitted%20Letters/DF16-19-03040b-FA%20ASO%20Ack%20Ltr.pdf","method":"GET","postMessageId":"SP.RequestExecutor1","timeout":90000}
    20	SP.RequestExecutor.js:2  
    				:RequestExecutor.PostMessage.Target: https://vendorsharepoint.sharepoint.com/_layouts/15/AppWebProxy.aspx
    21	AppWebProxy.aspx?SP.AppPageUrl=https://divisiongroup/SiteAssets/CORSTestRESTRequests.html:201 
    				ErrorPage.OnMessage: Origin=https://divisiongroup, Data={"command":"Query","url":"https://vendorsharepoint.sharepoint.com/:b:/r/Corres/Submitted%20Letters/DF16-19-03040b-FA%20ASO%20Ack%20Ltr.pdf","method":"GET","postMessageId":"SP.RequestExecutor1","timeout":90000}
    22	AppWebProxy.aspx?SP.AppPageUrl=https://divisiongroup/SiteAssets/CORSTestRESTRequests.html:231 
    				ErrorPage.PostMessage: Origin=https://divisiongroup, Data={"command":"Query","postMessageId":"SP.RequestExecutor1","responseAvailable":false,"errorCode":-1007,"errorMessage":"Correlation ID: 6f842b9f-b0ca-a000-ef66-88b16d4445ad"}
    23	SP.RequestExecutor.js:2  
    				:RequestExecutor.OnMessage
    24	SP.RequestExecutor.js:2  
    				:RequestExecutor.OnMessage: Message.data={"command":"Query","postMessageId":"SP.RequestExecutor1","responseAvailable":false,"errorCode":-1007,"errorMessage":"Correlation ID: 6f842b9f-b0ca-a000-ef66-88b16d4445ad"}
    25	SP.RequestExecutor.js:2  
    				:RequestExecutor.OnMessage: Message.origin=https://vendorsharepoint.sharepoint.com

    It seems that the transaction involves a "ping" command on line 11, followed by a response (?) on line 13 that is an error and more error info on line 14.  Then there is a "query" command on line 19 followed by more error info on lines 21 and 22.

    The script calls the AJAX error function after all this messaging/transaction occurs.

    Can anyone figure out what is happening in this activity? Thanks



    • Edited by Mavi Gozler Tuesday, January 14, 2020 11:08 PM
    Tuesday, January 14, 2020 11:04 PM

All replies