HTTP Outcalls Consensus Failure - Discord Webhook Request

Issue Description

I’m experiencing a consensus failure when making HTTP outcalls to Discord webhooks from my IC canister. The error indicates that replicas are returning different responses, preventing consensus from being reached. Additionally, I’m receiving multiple duplicate Discord messages instead of just one, suggesting the request is being processed multiple times.

Error Details

Failed to send webhook: Request failed: (SysTransient, “No consensus could be reached. Replicas had different responses. Details: request_id: 112432, timeout: 1757795577378071499, hashes: [b3ece9ff483b8675f8f0e65ad43bdaa40723544d9994b5125526db18728e094c: 1], [ab6b89f5d2d277ad9bf44acdfc8847ff85c5f68f70e195f5bcb701eabf905001: 1], [7753ca3b315ad95979d8a7de62214792e4ee3927161383ec39613a662e5ed4b5: 1], [699de35216ea55c658e203cb8f558a99e0e458c126af2d5a2dc54bd0f4042179: 1], [56a86bcecc3d04ff5d397f325aa3aad83db3b870bf906d74eed7342c6fbcf2b0: 1], [018bf18c4c6f09dadee41f7535415997dc1f24973a265a43010c3d0c0190ebc9: 1]”)

Technical Setup

Code Implementation

// HTTP Request Structure
let request = CanisterHttpRequestArgument {
    url: webhook_url.to_string(),
    method: HttpMethod::POST,
    headers: vec![
        HttpHeader {
            name: "Content-Type".to_string(),
            value: "application/json".to_string(),
        },
    ],
    body: Some(discord_payload.to_string().into_bytes()),
    max_response_bytes: Some(MAX_DISCORD_RESPONSE_BYTES),
    transform: None,
};

// Making the request
match http_request(request, DISCORD_REQUEST_CYCLES).await {
    Ok(_) => println!("Webhook sent successfully"),
    Err(e) => println!("Failed to send webhook: {}", e),
}

GitHub Repo:
github.com/AbdulrahmanFiala/chain_notary

Problem is that HTTP outcalls must be idempotent
(Here are docs). I believe that’s the reason you’re getting the error you mentioned.

However - there is a solution already - you don’t need necessarily need consensus for HTTP outcalls anymore. More details are here:

You’re spot on. I’ve been struggling with this issue for some time now, although I read that it has some security downsides but as long as the app works I couldn’t care much for the security downside, at least for now :”D

Side question - Are you building this in scope of LegalHack? :blush:

Nope, I’m participating in the World Computer Hacker League, actually our team ChainNotary won the 3rd place in the National competition round, and we’re now participating in the regional round. Wish us luck! What about you, are you currently participating in any ICP hackathons?

Good luck :blush:

Yeah, I’m building XFusion on WCHL as well. Hopefully we’ll meet in the final round :blush:

https://forum.dfinity.org/t/xfusion-many-tokens-one-trade/55977