API Connector - Setting up different environments

Hello all :slight_smile:

I’m working on an app that needs to connect to two different APIs (dev or prod) according to the bubble environment.

To simplify, let’s say only the live environment and the master branch (version-test) have to connect to the prod API, the rest has to connect to the dev API.

Using API Connector, I’m able to set a variable where the API hostname would go within the endpoint URL. This variable has a default value for me to initialize it in the plugin page, it is set to public and thus I am supposed to be able to change it from within the bubble app, when I call the API workflow.

However it does not seem to work, trying to set the hostname to a gibberish value (litteraly “invalid”) still makes the call succeed and I can’t figure out why…

How i configured it is using option sets. I have a HOSTNAMES option set with two different options: API_DEV and API_PROD. I use another plugin (Global Custom State) to save the appropriate value, depending on the URL (version-test or no version at all for the live environment) to the global state and then pass the global state value to API Connector to fill the hostname.

Using debug mode I know the value of the global state changes depending on the page URL, as expected. I also know that the API connector receives the “invalid” value for the hostname.

However, the API call still succeeds and answers with the response expected for the proper hostname. What could explain this behavior ?

Screenshot from 2023-11-03 11-51-50

Has anyone had experience in setting up different environments like this (or in any other way, i’ve heard of the “isn’t live” condition but this would not trigger for the master branch from my understanding) in a bubble app ?

Any tips would be greatly appreciated!