Heroku External Objects
Last updated November 12, 2024
Table of Contents
Heroku External Objects is available as part of Heroku Connect. It provides an oData wrapper for a Heroku Postgres database that has been configured for use with Heroku Connect. This feature allows other web services to retrieve data from within the specified Heroku Postgres database using RESTful endpoints generated by the wrapper.
Used in tandem with Salesforce Connect, the feature permits data in a Heroku Postgres database to be represented in a Salesforce deployment, where it can be viewed (including within Apex and Visualforce pages), searched, and related to other objects. It can’t be used in standard reports as the data is only available by reference.
Service Authentication
External Objects service endpoints are protected by basic authentication. After the service is enabled, credentials can be viewed, reset, and revoked from the External Objects settings page.
Your new and old credentials are accepted for a 10-minute period after you reset your credentials. Update the credentials in your consuming services, such as your Salesforce org, within this timeframe to avoid downtime.
Resource Configuration
When the External Objects service is active for a connection, a list of available tables and views appears in the External Objects settings page. Tables and views across all schemas within the associated connection’s database are available, including those schema not actively managed by Heroku Connect as part of the synchronization service. Any of these tables or views can be enabled or disabled as a resource in the External Objects service by selecting the corresponding checkbox in the settings page.
To be enabled as an External Objects resource, tables must contain a primary key column. Views must have a column named id
.
Rate Limits
The External Objects service is rate-limited at 20,000 requests per hour for the shield
, enterprise
, or danketsu
paid Connect plans; rate limits can be increased on request. For the demo
plan, the limit is 1,000 requests per hour.
If you have multiple instances of Heroku Connect, each Connect instance has its own, separate External Objects rate limit.
Attempting to access services after this limit has been reached results in a 429 Too Many Requests
error. The response message also contains information about when to expect to be able to make another API request. Rate limit throttles reset at the top of each hour.
{"message":"Request was throttled. Expected available in 1000.0 seconds."}
Logging
Administrative changes made to configuration such as credential reset and revocation, and database object inclusion and exclusion are logged as part of Heroku Connect’s Audit Messages.
Heroku External Objects produces logs of its request and ratelimit activity, which you can access from your log drain (see also, Heroku Connect Application Logging). It generates one message to capture the ratelimit that has been used and the total ratelimit for the service, which would look like:
2020-02-12T19:13:07+00:00 app[herokuexternalobjects]: addon_id=82b1c244-592d-4165-99e7-89a270459752 object_type=sync object_id=55cae68a-0628-4497-bbcd-b32cf3b7c5cf state=IDLE request_id=3d4917bc-d255-2c69-4e3d-fa4f8a2a733f method=GET path=/odata/v4/fefbdf7b43794182af6cb7c1fc04fbf9/schema$lead at=ratelimit ip=127.0.0.1 ratelimit_used=38 ratelimit=22000 user_agent=python-requests/2.11.1 level=info
Heroku External Objects also generates a log message for the response it provides to the caller:
2020-02-12T19:13:07+00:00 app[herokuexternalobjects]: addon_id=82b1c244-592d-4165-99e7-89a270459752 object_type=sync object_id=55cae68a-0628-4497-bbcd-b32cf3b7c5cf state=IDLE request_id=3d4917bc-d255-2c69-4e3d-fa4f8a2a733f method=GET path=/odata/v4/fefbdf7b43794182af6cb7c1fc04fbf9/schema$lead at=response ip=127.0.0.1 service=82.94556713104248ms status=200 user_agent=python-requests/2.11.1 level=info
These logs can be correlated by the request_id
.
Supported Data Types
Heroku External Objects supports the following PostgreSQL data types:
bigint
boolean
bytea
character
/character varying
date
double precision
integer
numeric
real
smallint
text
time
(see the following note)timestamp
uuid
If you enable a table or view that has an unsupported data type, the unsupported field isn’t included in the results.
Salesforce Connect doesn’t support the TimeOfDay
OData type, which corresponds to the time
data type in PostgreSQL. Heroku External Objects can expose time
fields, but they’re ignored when using Salesforce Connect to create external object definitions.
Limitations
Generated Identity Defaults for Primary Key
PostgreSQL added support for an alternative to using SERIAL
or BIGSERIAL
by creating a primary key column with GENERATED BY DEFAULT AS IDENTITY
or GENERATED ALWAYS AS IDENTITY
. These defaults aren’t supported by Heroku External Objects and cause the creation of new records to fail. Retrieving, updating, and deleting works.
Case-Insensitive Search
Searches in Salesforce for data in External Objects are done in a case-sensitive manner. Case-insensitive searching isn’t supported by Heroku External Objects.
Batch Apex
Using Batch Apex in Salesforce to query Heroku External Objects isn’t supported.
External Change Data Capture
Heroku External Objects doesn’t support the External Change Data Capture feature in Salesforce Connect.
Free-Text Search Expression
Heroku External Objects doesn’t support Free-Text Search Expression search queries from Salesforce Connect.
Global Search
Query results appear under External Results
when using Salesforce’s Global Search.
Query Time Limit
Queries generated by Heroku External Objects must complete in 20 seconds or less, otherwise Heroku External Objects returns a 530 response to Salesforce Connect.
Compress Requests
Enabling the Compress Requests option for an External Data Source in Salesforce isn’t supported.
Estimated odata.count Value
Counting the rows in a Postgres table is slow and can be intense for a database. As a result, when returning paginated results for a query, Heroku External Objects returns 50 records at a time and returns one more than the number of records to indicate that there are more results.
Tables Without Columns Are Unsupported
While PostgreSQL allows users to create a table without a column, it’s not compliant with the SQL specification and semantically ambiguous in the context of Heroku External Objects. As a result, Heroku External Objects doesn’t support (or display) tables that don’t have columns.
Composite Primary Keys Are Unsupported
Heroku External Objects doesn’t support composite primary keys. Instead of a composite primary key, create a column that stores the concatenated values of two or more source columns and set it as the primary key.
Partitioned Tables Are Unsupported
Heroku External Objects doesn’t support partitioned tables. In some cases, you can work around this limitation by creating a view over the parent table and selecting the view to be enabled in Heroku External Objects.