Force.com-JavaScript-REST-Toolkit icon indicating copy to clipboard operation
Force.com-JavaScript-REST-Toolkit copied to clipboard

ApexRest -- No 'Access-Control-Allow-Origin' header is present code 401

Open craigisakson opened this issue 8 years ago • 19 comments

We have multiple orgs using ForceTK to call ApexRest services from VisualForce pages. Everything has been working just fine until last night. Now none of our calls are going through:

XMLHttpRequest cannot load https://cs41.salesforce.com/services/apexrest/v1/productmarkets/. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://c.cs41.visual.force.com' is therefore not allowed access. The response had HTTP status code 401.

We've added the CORS records to the org with no difference in outcome. I understand that this is more than likely not a ForceTK issue, but something that has changed on the Salesforce side. I'm wondering if anyone might have suggestions on things I can try to get this to work?

craigisakson avatar Jul 06 '16 15:07 craigisakson

We are having the same problem in Chrome. In Firefox we are getting a 405 Method not allowed.

Bobnix avatar Jul 06 '16 15:07 Bobnix

Yep, I have the same issue. Prod is working fine, but all of your sandboxes, including QA, are broken. I'm investigating changing the code to use remoting. I may put in a ticket to Salesforce.

mikesobczak avatar Jul 06 '16 16:07 mikesobczak

We also have a case open with Salesforce as well. If we hear anything back from it I will add it to this issue!

craigisakson avatar Jul 06 '16 18:07 craigisakson

SF told me they have another customer with the same issue. They verified that my issue was with the apexrest call. I went ahead and changed my code to use VisualForce JavaScript remoting.

mikesobczak avatar Jul 06 '16 21:07 mikesobczak

We're facing this issue too and have opened a case. Starting today we're also facing it in Production - not just sandboxes.

koenwesselman avatar Jul 07 '16 14:07 koenwesselman

Any update? We are facing this issue in production and sandbox environment. WORKAROUND: Use @HttpPatch

dieffrei avatar Jul 07 '16 14:07 dieffrei

We've been referred to this knowledge article: https://help.salesforce.com/apex/HTViewSolution?urlname=XMLHttpRequest-cannot-load-No-Access-Control-Allow-Origin-is-present&language=en_US

Haven't yet given it a try.

koenwesselman avatar Jul 07 '16 15:07 koenwesselman

We are seeing this in production as well, although ours manifests as a 503 with an "under construction" HTTP page returned from the server.

brosiusad avatar Jul 07 '16 15:07 brosiusad

koenwesselman I tried It, but it doesn't work. Only works for "PATCH" method.

dieffrei avatar Jul 07 '16 15:07 dieffrei

We are facing the exact same situation. Yesterday night, one Sandbox was affected. As of this morning, every instance including Production are down. Support pointed to the exact same knowledge article. Adding CORS settings made it work for Internet Explorer 11 and Edge, but every other browser (Chrome, Firefox, Safari, Salesforce1 iOS App) is affected.

felixguinetincloud avatar Jul 07 '16 15:07 felixguinetincloud

May its about the last salesforce update:

Thursday July 07, 2016 06:35 UTC On July 7, 2016, the Salesforce Technology team resolved a service disruption issue affecting the Salesforce Mobile Classic service. The problem began on July 6, 2016 at 20:51 UTC and was resolved as of July 7, 2016 06:35 UTC.

The problem was caused by a configuration issue on the network tier supporting the Salesforce Mobile Legacy application. Once identified, action was taken to rectify the configuration and normal functionality was restored.

Actions to Prevent Future Incidents: The Salesforce Technology Team -

  • Is investigating the cause of the configuration issue and the resulting impact
  • Is investigating ways to detect this sort of issue more rapidly in the future

Seen at: http://trust.salesforce.com/trust/instances

dieffrei avatar Jul 07 '16 16:07 dieffrei

We are also facing same issue in all Sandboxes and also in Prod. The code used to send an Ajax request from visualforce page to REST service (POST). This was working fine till today and now it has stopped working. I changed Ajax request from POST to PATCH and its working fine. Does anyone know what has changed for POST requests?

mandar19 avatar Jul 07 '16 18:07 mandar19

I've got the same issue in one of the orgs I look after. Just started happening out of the blue this morning. Following the steps in that knowledge article does not solve the problem. Unfortunately this org does not have premier support so I can't file a ticket on it. Has support responded to any of you with a solution or a timeline on a solution yet?

scottmcclung avatar Jul 08 '16 00:07 scottmcclung

scottmcclung I notified by opened case, that R&D salesforce team is working on it.

dieffrei avatar Jul 08 '16 00:07 dieffrei

Apparently, an update was rolled out yesterday and introduced the problem. Support are aware of several customers affected (I believe the number given is under estimated only with the number of participants in this thread so you should contact them right away). Apparently the R&D team is working on it, but I wasn't able to get any idea of the resolution timeline. There is no sign of any problem on status.salesforce.com

felixguinetincloud avatar Jul 08 '16 01:07 felixguinetincloud

Hi folks, a Known Issue has just been created. Update is apparently scheduled this weekend. Please monitor : https://success.salesforce.com/issues_view?id=a1p3A00000185IjQAI

felixguinetincloud avatar Jul 09 '16 00:07 felixguinetincloud

I tested both our Production and Sandbox this morning and everything seems back to normal. Can you validate on your side? I see no notes/memo/communication on what really happened..

felixguinetincloud avatar Jul 09 '16 14:07 felixguinetincloud

Thank you Felix, It is fixed!

dieffrei avatar Jul 09 '16 19:07 dieffrei

@dieffrei Could you please share, how this issue got fixed.

jaskkaur avatar Oct 14 '19 11:10 jaskkaur