Hi all, we’re seeing intermittent 401 Unauthorized errors when our Architect flow POSTs data to an Azure Function. It’s driving me a bit mad. The flow’s simple enough - a voice call triggers it, we collect some ACD details, then send those details as JSON to our function, which then updates a record in our CRM. At my last shop, we had similar issues with authentication headers, but this is different. The Azure Function uses a system-assigned managed identity - no API keys or secrets, which is good. The function itself is running .NET 6 and the Genesys Cloud SDK version is 2023.12.0. I’ve confirmed the function’s identity has the Contributor role assigned to the relevant resource group.
The odd thing is, it works perfectly most of the time - maybe 80% success. Then it’ll fail with a 401 for a period, then start working again. The logs from the function show a missing or invalid authorization header. The Architect flow’s webhook configuration is set up correctly, I think - the ‘Authorization’ header is set to ‘Bearer’ and the value is passed from the function. It’s not a token expiry issue, because even retrying immediately after a failure results in the same 401. I even tried adding a small delay (5 seconds) before the POST in the flow, but that didn’t fix it.
Here’s the relevant section of the Architect flow’s debug log when it fails:
2024-01-26 13:35:22.123 ERROR Webhook - Post to https://my-azure-function.azurewebsites.net/api/crm-update failed. Status Code: 401, Reason: Unauthorized
The Azure Function logs show:
2024-01-26 13:35:22.456 Microsoft.Azure.WebJobs.Host] Error: 401 - Unauthorized - Identity not found
I’m starting to suspect something with how the Genesys Cloud platform handles the authentication handshake. It’s probably some weird race condition. It’s just so random.