Why does Salesforce report a "400 Bad Request" response when performing a large query against Heroku External Objects?

Issue

When querying a large number of fields using Heroku External Objects, Salesforce reports the following error message:

The external system responded with an HTTP error "400 Bad Request". The system tried to reach this URL: https://odata-us.heroku.com/odata/v4/...

Resolution

Heroku applications, including the ones that power Heroku External Objects, support a maximum request line length of 8,192 characters. This limit includes the base URL and the query string parameters, which is where Salesforce includes in search criteria.

Simple queries against a few fields will fit well within this range, but when querying against a lot of fields, it's not uncommon to exceed this limitation. Because each field and its requested value are listed independently, the query string in the URL grows with each field that's added to the search.

Exactly how many fields will fit within the limit will depend on the lengths of field names and the values being searched for. The error message includes the actual URL that was tried, so you can check to see if it exceeds this limitation.

Reducing the number of fields to search in will allow your query to fit within the request limitation, and Heroku External Objects will be able to service the request successfully.

Ask on Stack Overflow

Engage with a community of passionate experts to get the answers you need

Ask on Stack Overflow

Heroku Support

Create a support ticket and our support experts will get back to you

Contact Heroku Support