You need to sign in to do that
Don't have an account?
Manfred Linzner
Bulk API: InvalidSessionId (Unable to find session id)
I'm planning to use the Bulk API for a project on Google App Engine. I've started writing some simple test code to create two Tasks using the Bulk API via the Python [salesforce-bulk-api](https://github.com/safarijv/salesforce-bulk-api) library:
Executing this code locally works as expected and the two Tasks appear in Salesforce. But running the code on Google App Engine, it fails. The job / batch details are:
From what I see in the documentation, session ID needs to be sent via header field `X-SFDC-Session` each time. I've checked that and it is set when executing locally as well as via Google App Engine. Headers looking like this:
Anyone having tips how to debug / resolve this issue? Thanks!
– Manfred
from salesforce_bulk_api import SalesforceBulkJob header = ['WhoId', 'Subject'] messages = [('[...]', 'Test Task 1'), ('[...]', 'Test Task 2')] os.environ['SALESFORCE_INSTANCE'] = '[...]' os.environ['SALESFORCE_SECURITY_TOKEN'] = access_token job = SalesforceBulkJob('insert', 'Task') job.upload( header, messages ) results = job.results() for r in results: print('Result ' + str(r))
Executing this code locally works as expected and the two Tasks appear in Salesforce. But running the code on Google App Engine, it fails. The job / batch details are:
<error xmlns="http://www.force.com/2009/06/asyncapi/dataload"> <script/> <exceptionCode>InvalidSessionId</exceptionCode> <exceptionMessage>Unable to find session id</exceptionMessage> </error>
From what I see in the documentation, session ID needs to be sent via header field `X-SFDC-Session` each time. I've checked that and it is set when executing locally as well as via Google App Engine. Headers looking like this:
{ 'Content-Length': '183', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'User-Agent': 'python-requests/2.9.1', 'X-SFDC-Session': u'00D2[...]vBmM', 'Connection': 'keep-alive', 'Content-Type': u'application/xml; charset=UTF-8'}
Anyone having tips how to debug / resolve this issue? Thanks!
– Manfred
Please check with below post from stack overflow community with similar issue.
- http://stackoverflow.com/questions/40788306/salesforce-bulk-api-invalidsessionid-unable-to-find-session-id-when-executed
Regards,Nagendra.P