Open chripede opened 3 years ago
The extent to which the client currently manages the session is:
access_token
from a successful login requestTo handle your scenario where session timeout is a factor and a fresh session id is needed, we would need to support the refresh token flow. I'd be open to it
I had "INVALID_SESSION_ID: Session expired or invalid" errors before, and found out the root cause was having concurrent sessions and one of them calling logout()
while the other sessions were still in use, and this invalidated them. Also, if you're using Client
as a context manager, logout()
will be called when the context exists.
See https://developer.salesforce.com/forums/?id=906F00000005LQoIAM
Never had a single INVALID_SESSION_ID again after I stopped calling logout()
or using Client
as a context manager.
Given this, I'd say that logout()
is evil and should never be called. Automatically refreshing the token would be hiding the issue, so I'm not if favor of adding that feature.
* By "using Client
as a context manager" I mean:
with sfdc.client(**client_args) as client:
...
When using this to bulk send data (one item at a time) I am hit with
Exception: [{'message': 'Session expired or invalid', 'errorCode': 'INVALID_SESSION_ID'}]
regularly.
For each request I do
with SalesforceClient as client
so there is no way it will actually expire, unless it does within a second?