Azure Web PubSub : Request failing with Http Error 500 for Azure functions
Published Jan 30 2023 08:03 AM 4,923 Views
Microsoft

Recently one of our customers was facing issue in web pubsub with function app sample.

 

They followed the below simple chat sample and it was working fine while running locally.

 

azure-webpubsub/samples/functions/csharp/simplechat at main · Azure/azure-webpubsub · GitHub

 

After publishing the code to azure we started to receive below error

 

500Error.png

 

On further analyzing we found that there are 2 application settings keys missing in function app which was causing this error. 

 

1. WebPubSubConnectionString : This will be available under your pub sub account -->Settings -->Keys and you can consider either primary or secondary key

 

ConnString.jpg

 

 

2. WebPubSubHub : Name of the hub configured in pub sub account under pub sub -->Settings --> Settings

 

Hub.png

 

After adding WebPubSubConnectionString and WebPubSubHub to the function app, issue got resolved.

 

ajaysuvarna_1-1675092027382.png

 

 

With the above keys in place application started working

 

ajaysuvarna_2-1675092658347.png

 

Alternatively, we can also deploy function app using Azure Functions Core Tools (Azure/azure-functions-core-tools: Command line tools for Azure Functions (github.com)), basically does the same thing, updates the Application Settings in Function App using local.settings.json file.

 

 

 

func azure functionapp publish <FUNCIONAPP_NAME> --publish-local-settings

 

 

 

Hope this helps!!!

 

 

Co-Authors
Version history
Last update:
‎Jan 30 2023 08:01 AM
Updated by: