I am getting similar error on two different Bot built in different regions Error There was an error generating a response. Chat history can't be saved at this time. Error code: 401

Vaibhav Shah 0 Reputation points
2024-09-27T17:38:00.2666667+00:00

I am getting similar errors on two different Bots built in different regions. I have two Bots built on OpenAI Playground ChatGPT 4. One of them is in Canada East and another is in East US. There is a blob storage connect to access documents to answer the question via Azure AI Search services.

Both were working fine before and recently started getting below error.

Error

There was an error generating a response. Chat history can't be saved at this time. Error code: 401 - {'error': {'code': 'PermissionDenied', 'message': 'Principal does not have access to API/Operation.'}}

I have tried by resetting the API keys and also copying them in the in WebApp Environment variable "AZURE_OPENAI_KEY" with no luck.

The WebApp I have deployed opening properly. The error comes when I ask question to the bot.

Any help will be appreciated.

Azure
Azure
A cloud computing platform and infrastructure for building, deploying and managing applications and services through a worldwide network of Microsoft-managed datacenters.
1,041 questions
Azure OpenAI Service
Azure OpenAI Service
An Azure service that provides access to OpenAI’s GPT-3 models with enterprise capabilities.
2,997 questions
Azure Static Web Apps
Azure Static Web Apps
An Azure service that provides streamlined full-stack web app development.
921 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Sina Salam 10,261 Reputation points
    2024-09-27T21:14:46.3866667+00:00

    Hello Vaibhav Shah,

    Welcome to the Microsoft Q&A and thank you for posting your questions here.

    I understand that you are having an error on two different Bot built in different regions and there was an error generating a response and alos, chat history can't be saved at this time with Error code: 401

    What you are experiencing is a permission-related issue not because it's general region issue with your Azure OpenAI bots. The error code 401 indicates an authentication issue, which always related to invalid credentials, insufficient permissions or roles. You will first need to make sure that the API keys are correct, and not expired, and properly set in the WebApp Environment variable “AZURE_OPENAI_KEY”. Folllow this links to be able to resolve the issues using best practices:

    This is a similar issue on this platform answered by @AshokPeddakotla-MSFT via https://video2.skills-academy.com/en-us/answers/questions/1696839/trouble-connecting-to-azure-openai-api-%28401-error%29 and @VasaviLankipalle-MSFT via https://video2.skills-academy.com/en-us/answers/questions/1722903/401-error-while-trying-to-access-azure-openai-serv

    I hope this is helpful! Do not hesitate to let me know if you have any other questions.


    Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful.

    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.