HTTP Out calls and "no consensus was reached"

Hi!
Maybe I missed something basic here about ICP Outcalls.
I have an api to call from my canisters, When I used Swagger to make a POST request, I got one log with POST, but when I do the same call from a canister I got multiple POST calls, does that mean in main net each validator ( if it is a correct name) do the same POST, so it ends with multiple POST requests?
That does not sound good, because in this case I must always create a middleware to check if the same POST was done before and rsponse with the saved data? Please help,

And plus the issue I do not find any solution for “Uncaught (in promise) Error: Call was rejected:
Request ID: 6ebfe0…
Reject code: 4
Reject text: Canister http responses were different across replicas, and no consensus was reached”

At a high level, multiple replicas (or nodes) call the API within milliseconds of each other and get a response. The replicas then agree on the response and return a response to the canister if all server responses received by the replicas are the same.

You are getting the error Canister http responses were different across replicas, and no consensus was reached because the response was different across the replicas calling it.

For GET requests, you can use a transformation function to remove fields in the response that are supposed to be different when calling at different times (ex. timestamp).

For POST requests, as in your case, it is a bit more complicated.

Could you possibly add an idempotency key?

1 Like

Ok, got it now ( was expecting this multiple POST call ) I will check the idemponecy key as you mentioned, thanks!