Persistent Error When Using ChatClient

John Siri 0 Reputation points
2025-04-28T05:37:13.49+00:00

Screenshot 2025-04-28 at 1.31.32 AM

When trying to list participants or messages, I continuously receive errors. I am able to use the connection string to send messages, but am unable to fetch the latest message to return. When doing so, I get the following error.

Screenshot 2025-04-28 at 1.35.15 AM

The chat previously had worked locally, but struggled when hosted. I see that it is Azure Front Door related, but that does not seem particularly relevant to fetching messages when I am able to send them.

Azure Communication Services
Azure Communication Services
An Azure communication platform for deploying applications across devices and platforms.
1,129 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Siva Nair 1,475 Reputation points Microsoft External Staff
    2025-04-28T07:04:32.64+00:00

    Hi John Siri,

    Based on the above error we got , lets understand few troubleshooting steps to resolve our issue:

    1. Since you can send messages but fetching fails, it’s likely that Front Door isn’t routing API calls (e.g., for listing messages) correctly to your backend. Verify that API paths like /messages or /participants are routed to the right backend service. Set up "path-based routing" to make sure Front Door forwards requests to the correct backend service. Azure Front Door route matching and configuration and How to configure endpoints and routing rules
    2. Double-check that your hosted environment matches your local setup, especially around base URLs, environment variables, and endpoint configurations. Compare the local configuration with your hosted settings, ensuring the URLs and authentication tokens are correctly set. Configure App Settings in Azure App Service
    3. https://azurefrontdoorpages.azureedge.net/pages/PageNotFound_files/favicon.ico), suggests that Azure Front Door is not routing the request to the backend correctly. Instead of returning the expected API response, it’s returning a static 404 error page. This is a strong indicator that routing or path matching is misconfigured. Azure Front Door troubleshooting and diagnostics
    4. While less likely the root cause here (since you can send messages), it’s good practice to ensure your application has both send and read permissions if you’re using services like Azure Communication Services. Authentication and permissions for Azure Communication Services
    5. Review CORS and Authentication (if applicable): If your frontend and backend are on different domains, ensure that CORS policies are correctly configured and that authentication tokens are valid in the hosted environment. Azure Front Door and CORS support and Azure Communication Services authentication

    Thanks! John Siri, for sharing this , am mentioning it here so that others can have collective answer for this issue-

    solution applied by John- the error got fixed when he removed the access key to the URL. he think that the access key made it assume I was trying to route through Azure Front Door.

    If the answer is helpful, please click Accept Answer and kindly upvote it so that other people who faces similar issue may get benefitted from it.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.