Skip to main content

Report Export- Session Expired or Invalid

If you're getting an invalid session ID error, read this article for information and the solution.

Overview

Some users may encounter the Report Schedule error, INVALID_SESSION_ID, when exporting Reports and Dashboards. This behavior is due to a change in how Report Sender works, which uses a Heroku service, and is not an issue with the Report Schedule itself.

Example Error

Error in exporting Report: All Accounts and Contacts

Salesforce Server Response Code: 502
Response Body: {"error":"Report export failed","details":"Salesforce returned 401: [{\"message\":\"Session expired or invalid\",\"errorCode\":\"INVALID_SESSION_ID\"}]"}

Who is Affected?

With Salesforce's security change to Step-up Authentication for Report Actions, we had to move some file generation to our Heroku endpoint. This affects anyone sending any report type besides Formatted XLSX.

The Cause

There may be a few settings that cause this, including IP restrictions. But the most common cause is when the following setting is enabled:

Setup→ Session Settings → Lock sessions to the IP address from which they originated

If this is not the cause, please contact our support team to look into other issues.

What Happens?

When exporting a Report or Dashboard, Report Sender generates Formatted XLSX in Apex, but generates the rest in our Heroku microservice. With “Lock sessions to the IP address from which they originated,” Report Sender is not able to connect to Salesforce from the Heroku service, blocking the export of your data.

The Solution

To resolve this issue, you will need to navigate to the Session Settings in your Org and disable “Lock sessions to the IP address from which they originated”.

Step 1: Open Setup and Navigate to Session Settings

Step 2: Disable “Lock sessions to the IP address from which they originated.” Make sure this checkbox is unchecked.

Scroll down and click Save to apply changes

How to Reset your OAuth Token

After disabling the setting, you will either need to revoke your OAuth token for Report Sender and reauthenticate it, or wait for the session to time out, which can take 2 or more hours, depending on your Timeout Value in the session settings.

Step 1: Navigate to your user settings

Step 2: Search for Connections

Step 3: Click Revoke

Step 4: Click Approve Access

Step 5: Allow Access

Now that you have successfully disabled “Lock sessions to the IP address from which they originated” and reset your OAuth token, Report Sender will work as intended.

If you’re still having issues, use the chat widget to reach out!

Did this answer your question?