No Access-Control-Allow-Origin header is present message on bulk API response via Visualforce page
See original GitHub issueI have a Visualforce page that I am using to bulk upload records from a csv file. In using the JSforce framework, I am creating my connection like this:
var conn = new jsforce.Connection({
accessToken: '{!$Api.Session_Id}',
serverUrl: 'https://cs7.salesforce.com',
proxyUrl: '/services/proxy'
});
This org also has the My Domain option configured, and I have tried setting the serverUrl with the custom domain name as well. I am able to create a job, and batches, and execute them, but when the “onresponse” event fires, I start getting this error message:
XMLHttpRequest cannot load https://mydomain--demo.cs7.my.salesforce.com/_ui/common/request/servlet/JsLoggingServlet. No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘https://mydomain--demo--c.cs7.visual.force.com’ is therefore not allowed access.
In my current codebase, I am creating the job manually:
var job = conn.bulk.createJob('SMBulk__c','insert');
And adding the batches to that job:
var batch = job.createBatch();
batch.execute(subfile);
I have also tried this using the bulk load method as well:
conn.bulk.load("SMBulk__c","insert",subfile,
function(err,rets){});
Any help or advice would be greatly appreciated!! Jim
Issue Analytics
- State:
- Created 9 years ago
- Comments:6 (3 by maintainers)
Top GitHub Comments
I was wrong. It still needs
proxyUrl
when using bulk API, surely it accepts bulk API request but it redirects to other domain than Visualforce page. I think @jimrae 's last setting is the one how to connect to bulk API from Visualforce page.Thank you for the validation. That is the way I ended up setting up the configuration for my project.