An Azure service that provides an event-driven serverless compute platform.
Azure Function not being Invoked (no exception, no server logs)
I had the following setup;
- A SignalR service running locally via emulator
- An azure functions app running locally
- An AspNetCore client that invoked the above azure functions app
The azure functions app connected to my locally running SignalR emulator, and the AspNetCore client was able to get SignalR responses. In other words the entire above setup was working.
I now have the following setup:
- A SignalR service running on azure
- An azure functions app published on azure
- An AspNetCore client that invoked the above azure functions app
I have added a valid endpoint to my AzureSignalRConnectionString in Azure. My negotiate function gets invoked successfully. However when I try to invoke any of my OTHER azure functions via my client, nothing happens.
- I do not get an exception on my client to show anything went wrong
- There are no logs in Azure to indicate that an attempt was even made to call the function.
I suspect that there may be some authentication issue involved. Below is both my client and server side code, starting with client. Observe the 2 comments below:
private readonly HubConnection _connection;
private string _url = "https://XXXsignalrfuncapp.azurewebsites.net/api";
private string _userId = Guid.NewGuid().ToString();
public async void MainPage()
{
_connection = new HubConnectionBuilder().WithUrl(_url + $"?userid={_userId}").Build();
// This successfully invokes the server side Negotiate function
Task.Run(() => { Dispatcher.Dispatch(async () => await _connection.StartAsync()); });
// This does not invoke the server side function (server side logs are unchanged), nor does it trigger an exception here.
// It just executes and nothing happens
await _connection.InvokeAsync("AddToGroup", "GroupName1", _userId);
}
And here is my server side code using isolated process (observe comments above the functions):
// This gets invoked, server logs confirm success
[Function("Negotiate")]
public static string Negotiate([HttpTrigger(AuthorizationLevel.Anonymous)] HttpRequestData req,
[SignalRConnectionInfoInput(HubName = "serverless", UserId = "{query.userid}")] string connectionInfo)
{
return connectionInfo;
}
// This does not get invoked, server logs do not confirm any attempt on invocation
[Function("AddToGroup")]
[SignalROutput(HubName = "serverless", ConnectionStringSetting = "AzureSignalRConnectionString")]
public static SignalRGroupAction AddToGroup([SignalRTrigger("serverless", "messages", "AddToGroup", "groupName", "userId")] SignalRInvocationContext invocationContext, string groupName, string userId)
{
return new SignalRGroupAction(SignalRGroupActionType.Add)
{
GroupName = groupName,
UserId = invocationContext.UserId
};
I am assuming either of the following:
- My Negotiate function above needs to return something the client can use (token wise) for future function calls
- There is a missing configuration setting in Azure for my azure functions
Either way I am not sure how to go about these. Any help would be appreciated.