I have a visualforce page that is running with jsforce. I use it to query, create, update and deleted records in my page without reloading the page. For a longer period or idle time, I started to receive an error:


I have to refresh the page to re-login and submit again the form. I setup my jsforce instance like this:

<apex:page docType="html-5.0" showHeader="false">
  <apex:includeScript value="{!URLFOR($Resource.JSforce)}" />
var conn = new jsforce.Connection({ accessToken: '{!$API.Session_Id}' });
conn.query('SELECT Id, Name FROM Account', function(err, res) {
  if (err) { return console.error(err); }

I've added also actionPoller to prevent the page session from expiring but the error still occurring

        <apex:outputPanel id="rerenderDummy" style="display: none;">{!NOW()}</apex:outputPanel> 
        <apex:actionPoller action="{!incrementCounter}" reRender="rerenderDummy" interval="60"/>

How do I renew session id with jsforce without reloading the page? A little help would be appreciated. Thanks!


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.