Azure / azure-functions-signalrservice-extension

Azure Functions bindings for SignalR Service. Project moved to https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/signalr/Microsoft.Azure.WebJobs.Extensions.SignalRService .
MIT License
97 stars 47 forks source link

Output binding with group action removeAll gets 500 HTTP code and removeAll require groupName #217

Closed MrVhek closed 3 years ago

MrVhek commented 3 years ago

Hello, Using v1.3.0 in an Azure function with the following code :

def main(req: func.HttpRequest) -> str:
    message = req.get_json()
    return json.dumps({
        'userId': message['userId'],
        'groupName': 'test',
        'action': 'removeAll'
    })

The groupName is required even when I use removeAll which shouldn't require it. What is more strange is that I wasn't using it before and it was working. But the version I was using was not fixed... So I don't know what version I was using because with 1.0.0/1.1.0/1.2.2, it doesn't work either.

So I tried with a random groupName and now I received 500 error code:

[2021-04-27T12:34:00.721Z] Executed 'Functions.remove-user-from-all-groups' (Failed, Id=f84ea0f5-fd26-4eb2-a43b-c1c0578e19d9, Duration=75ms)
[2021-04-27T12:34:00.723Z] System.Private.CoreLib: Exception while executing function: Functions.remove-user-from-all-groups. Microsoft.Azure.SignalR.Common: Azure SignalR service runtime error. Request Uri: https://XXXXXXX.service.signalr.net/api/v1/hubs/chat/users/1-dev/groups. Response status code does not indicate success: 500 (Internal Server Error).

Is this intended behaviour ? Also Azure documentation doesn't provide any example of removeAll so maybe it is a feature that isn't supported.

Thanks for your help !

Y-Sindo commented 3 years ago

You mean removeAll suddenly not working since yesterday? Yesterday we had a deployment in the Azure SignalR Runtime and introduced a breaking change. We have already reverted the change. Please check if everything work well now. Sorry to bring some trouble.

MrVhek commented 3 years ago

Yes thanks, so it fixed the 500 HTTP code error. But before I didnt have to put the "groupName" parameter in the request, it should be optional since I want to remove the userId from all group. Also, previously the action removeAll was returning 204, now it returns 200 (not that it bothers me, but so you know).

vwxyzh commented 3 years ago

@MrVhek this api may return 200, see: https://github.com/Azure/azure-signalr/blob/dev/docs/swagger/v1.md#delete-remove-a-user-from-all-groups

Y-Sindo commented 3 years ago

Regarding to the "removeAll require groupName" problem, I checked the code history and confirmed that group name is required before "removeAll" function is published. Will removed the limitation.