Dealing with error 'An internal server error occurred, could not be parsed into a proper URI, missing scheme' when triggering API with HTTP request inside

I would like to describe a peculiar behavior of SAP BTP regarding iFlows with HTTP requests inside. Let me provide further details.

Initial set up

I have an iFlow that triggers an API and returns a JSON containing the request data.

For some reason, I decided not to expose the iFlow's endpoint to the 3rd party but to use an API endpoint. Therefore, I created an API for the iFlow to trigger.

See Expose Integration Flow Endpoint as API and Test the Flow

See Troubleshooting Gateway Timeout When Triggering SAP BTP APIM Endpoint

When it comes to testing, I try to trigger the API's endpoint but encounter the 500-response code.

Along with the following error in the BTP monitoring tool.

At this point, I may find myself asking a very logical question.

Fixing the issue

According to SAP Note 3257049 - Cloud Integration flow processing stops with IllegalArgumentException: {endpoint} could not be parsed into a proper Uri, missing scheme it is required to check several aspects of the developed iFlow.

See the PDF version of SAP Note 3257049 - Cloud Integration flow processing stops with IllegalArgumentException: {endpoint} could not be parsed into a proper Uri, missing scheme

Aspect # 1. You need all the headers to be passed into the iFlow

Check the Runtime Configuration tab of your iFlow.

If you have allowed all the headers to be passed into the iFlow, you should add the Content Modifier step right before the HTTP call. This step should remove the CamelHttpUri variable from the header.

💡
By using the Allowed Headers with * , that means all headers of the incoming message will be retained in the integration artifact. Hence, following headers are stored: CamelHttpUri, CamelHttpQuery, CamelHttpMethod for sure. 

Save the version of your iFlow and deploy the changes. The issue should be fixed from now on.

Aspect # 2. You don't need all the headers to be passed into the iFlow.

After analyzing the iFlow, you may come to the conclusion that you don't require all the headers to be passed into the iFlow and you want to reduce their amount, providing only those that are required. To do this, go to the 'Runtime configuration' tab of the developed iFlow and put their names separated with a pipe '|' if their amount is more than one.

As an example, in the iFlow I use for demonstration purposes in this post, I am requesting the weather using the Open Weather API to get weather details by providing two header parameters, longitude, and latitude. Hence, I can point only these two header parameters in the iFlow.

Deploy the changes and trigger the API.