I am trying to build a very basic workflow through desktop camunda modeler with a rest api connector to fetch response from a local post api with payload hosted on localhost and port 8009
I got it why it can’t communicate to localhost, so I tried to run my fastapi project in a container but I didn’t understand about running within camunda plaform network and communicating it through container name as rest api needs a url I can’t provide a container name there.
You can use a docker compose file to run your container within the network of camunda platform
You can find an example here, This example is running for connector runtime you can take snippet of adding a network from here and use it in your compose file
Make sure you check your nework name of camunda platform before adding it
For url you need to replace localhost with the name for your container
http://localhost:8009/api
instead of localhost give container name(assuming it as fastapi)
http://fastapi:8009/api
here we can see a host responding in my case it is “172.18.0.1” thus the host will change to this address and everything else remains the same therefore url will be http://172.18.0.1:8000/transaction.
It looks like your API Container name is actually api-web-1 rather than api, so calls to http://api:8000 won’t resolve from Camunda connector, since it would need to be http://api-web-1:8000
I tried that url too but then the error message changed to “api-web-1”.
Still I understood what was happening in the containers and the above URL worked for me in getting a response.