Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SignalRAttribute's HubName property has no validation #137

Open
look-im-not-your-daddy opened this issue Sep 28, 2020 · 0 comments
Open

Comments

@look-im-not-your-daddy
Copy link

look-im-not-your-daddy commented Sep 28, 2020

I'm not sure where this validation should occur (I believe during the functions' discovery/inspection/load), but it doesn't happen and when you call your injected IAsyncCollector<SignalRMessage>.AddAsync(message) having it being setup with an invalid HubName (which till today I didn't know about the existence of such thing) you'll get an HTTP 400 on your App Insights with no reasoning. Very hard to trace the reason behind it.

    public static class JobExecutionStatusUpdated
    {
        public const string EventName = nameof(JobExecutionStatusUpdated);

        [FunctionName(nameof(JobExecutionStatusUpdated))]
        public static Task Run
        (
            [ServiceBusTrigger("job_execution_status_updated")] JobExecutionStatusUpdate update,
            [SignalR(HubName = "myapp-notifications")] IAsyncCollector<SignalRMessage> signalR,
            ILogger logger
        )
        {
            logger.LogInformation($"*** [{nameof(JobExecutionStatusUpdated)}] received a message from queue 'job_execution_status_updated': '{JsonConvert.SerializeObject(update)}'");

            var message = new SignalRMessage
            {
                UserId = "0123-3456789",
                Target = EventName,
                Arguments = new[] { update }
            };

            return signalR.AddAsync(message);
        }
    }

Apparently hyphen is not welcome in a HubName (which I have no problem with) but I believe it should be stated somewhere in the docs or validated in the functions' discovery/inspection/load phase with the latter being very appropriate.

If stated in the docs somewhere, please point me to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant