Question:
Why Am I Receiving an “UNKNOWN ERROR: Read Error on Connection” in Workbench When Running Queries?
I was using Workbench without any issues, but later I started encountering the following error message for any query:
“UNKNOWN ERROR: read error on connection to ec2-34-194-152-137.compute-1.amazonaws.com:6379.”
I’ve tried different API versions and browsers, but the issue persists. Interestingly, it works properly when using Bulk CSV or Bulk XML options and downloading the file to view results.
Is anyone else experiencing this issue or knows how to resolve it? Any help would be appreciated!
Answer
This issue is related to changes in the infrastructure of Workbench and the services it uses, specifically updates to the Redis v6 configuration and requirements for TLS connections.
The Workbench application (hosted on Heroku and using AWS resources) uses the “Heroku Data for Redis” add-on as a session store for handling operations across multiple compute resources (called “Dynos” in Heroku terminology). Heroku updated the add-on to require TLS for connections, except for “mini” Redis instances, which only suggest using TLS.
The error occurs because:
- The Redis URLs and port numbers may have changed.
- The add-on uses a self-signed TLS certificate.
- PHP’s Redis driver had limitations in handling TLS connections.
Configuration changes were required, including disabling peer verification for the self-signed certificate, to establish a proper TLS connection. Additionally, updates to the session save handler in the Redis driver for PHP were needed to handle TLS connections.
The error stems from Redis v6 updates, where Heroku’s Redis add-on now requires TLS for most instances. The self-signed TLS certificate used caused connection issues, compounded by limitations in PHP’s Redis driver. Recent fixes in the Workbench GitHub project resolved this by updating the TLS setup and session handling. Testing shows the “List” option works correctly in API versions 57.0 and 58.0.
Example Workflow
Use the latest Workbench instance (workbench.developerforce.com) for interactive queries. If issues persist, use “Bulk CSV” or “Bulk XML” options as a fallback.
Code Fix Explanation
$redis = new Redis();
$redis->connect('tls://your-redis-url:port', 6379, 2.5);
$redis->setOption(Redis::OPT_SSL, [
'verify_peer' => false, // Disable peer verification for self-signed certificates
]);
session_set_save_handler(new RedisSessionHandler($redis));
The code configures Redis to connect using TLS, disables peer verification for self-signed certificates, and sets up Redis as the session handler. This ensures compatibility with Redis v6’s TLS requirements and resolves the connection issue.
Summing Up
The “read error on connection” in Workbench occurs due to changes in Redis v6, where TLS is now required for Heroku’s Redis add-on. This caused issues with the connection, as Workbench uses Redis for session storage. A self-signed TLS certificate and limitations in PHP’s Redis driver contributed to the problem.
The issue has been resolved in recent updates to Workbench on GitHub. Using the latest version of Workbench, the “List” option for “View As” now works correctly with API versions 57.0 and 58.0. As a workaround, “Bulk CSV” or “Bulk XML” options can still be used.
To fix the problem in a self-hosted Workbench instance, update Redis connection settings to support TLS and disable peer verification for self-signed certificates. This ensures compatibility with Redis v6 and resolves the connection issue.
Our Salesforce training in Hyderabad offers hands-on experience with real-world projects, expert instructors, and in-depth knowledge of Salesforce CRM. Whether you’re a beginner or looking to upgrade your skills, this course is designed to meet your needs. Enroll now to kickstart your Salesforce career!