JamesRandall / FunctionMonkey

Write more elegant Azure Functions with less boilerplate, more consistency, and support for REST APIs. Docs can be found at https://functionmonkey.azurefromthetrenches.com
MIT License
293 stars 49 forks source link

HTTP Trigger fails in the latest version 4.0.25-beta.1 #106

Closed alexeymarkov closed 4 years ago

alexeymarkov commented 4 years ago

Hi James,

I always get InvalidCastException: Unable to cast object of type 'System.Linq.Expressions.ParameterExpression' to type 'MyAssembly.Commands.TestCommand' when trying to run a HTTP Trigger function.

The problem is in this line: command = (MyAssembly.Commands.TestCommand)(await pluginFunctions.BindClaims(principal, command));

Something wrong with claims binders regardless of whether I configure it or not.

If the problem is unknown for you I could investigate and provide a fix.

Regards, Alexey

JamesRandall commented 4 years ago

I'll take a look this weekend and release a new beta (including the cancellationtoken in your other issue).

alexeymarkov commented 4 years ago

Thank you!

Regarding CancellationToken pay attention there are two of them : one injected into a function and another one from HttpContext.RequestAborted. If you cancel a http request only the second is triggered which makes the first useless IMHO. Maybe combining them into a single could be a solution (for http and for signalr triggers). Have a look at CancellationTokenSource.CreateLinkedTokenSource.

James Randall notifications@github.com schrieb am Fr., 20. Dez. 2019, 19:35:

I'll take a look this weekend and release a new beta (including the cancellationtoken in your other issue).

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/JamesRandall/FunctionMonkey/issues/106?email_source=notifications&email_token=ABOUZIDWZPLRME2GGWL4CVLQZUF53A5CNFSM4J47GBXKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEHNZGYI#issuecomment-568038241, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABOUZIEGF6KOUNVUOYBRB7DQZUF53ANCNFSM4J47GBXA .

JamesRandall commented 4 years ago

I've resolved this (commit 26991dc0caeacbe9bbbf8e76b415ef13c3814831) and added some test cases, should push out an update today / tomorrow.

Thanks for that info - will take a look!