-
Notifications
You must be signed in to change notification settings - Fork 263
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
Powershell durable functions: cannot pass complex output between activity functions #1922
Comments
Adding @AnatoliB for FYI |
@jformacek When you say "list of objects of System.Colections.Hashtable", do you mean a list of strings containing Invoke-DurableActivity -FunctionName 'Test2' -Input ($result | ConvertTo-Json -Depth 5) However, if you are actually talking about objects of |
Hello, |
This seems like something we should handle in our serialization docs for Durable. I believe we have advice there for Python + Node, so some PowerShell specific advice (such as default serialization depth) may be a good idea as well. |
I am also experiencing this issue while calling an I have tried taking control over serialization, but it hasn't succeeded so far. Even as I pass a string, the Orchestrator: $jsonInput = [PSCustomObject]@{
Result = $_
(...)
} | ConvertTo-Json -Depth 5
Write-Host "Calling ActivityFunction with: $($jsonInput)"
[PSCustomObject]@{
Result = $_
Task = Invoke-ActivityFunction -FunctionName 'ActivityFunction' -Input $jsonInput -NoWait
} Output from Write-Host in
So I know my deserialization works. ActivityFunction: param(
[Parameter(Mandatory)]
[string]
$InputData)
Write-Host "ActivityFunction: Got JSON input $InputData"
$InputData = $InputData | ConvertFrom-Json My Write-Host in From the serialization I get this exception, which makes sense if the value is not valid JSON:
|
Also I think an error message would be in handy when an object is deeper than supported, a user will not expect serialization issues in the framework. At least I didn't ;) Or even better, do not set a serialization depth... But I'm guessing that is a PowerShell issue. Even if so, this is very unexpected for users. |
So... this is a workaround for the issue. ActivityFunction: param(
[Parameter(Mandatory)]
[object]
$InputData)
Write-Host "ActivityFunction: Got JSON input $($InputData | ConvertTo-Json -Depth 5)" The framework will try to serialize to an # sample user input
$object = Get-Host
$myStringInput = $object | ConvertTo-Json
# framework deserialization
$frameWorkJson = $myStringInput | ConvertTo-Json
# framework serialization
$string= $frameWorkJson | ConvertFrom-Json
$string.GetType() #should be of type string, containing deserialized object! |
Thank you for reaching out @snerte. The current serialization behavior is problematic, I agree, but unfortunately it is quite hard to fix without introducing a breaking change. I'm currently working on releasing the next major version of the Durable Functions for PowerShell SDK, and I have included the fix for this serialization problem in there. I'll have more updates on this once we approach our release date, but I'll make a note to officially document this problem in the meantime. Thanks! |
hi @davidmrdavid do you have a release date yet for that next version? |
Yeah we're interested in this too 👍 |
@anthonywhite , @Manbearpiet , @snerte, @jformacek: This took a bit to release, but this new version of the SDK has finally been announced here. That version greatly increases the serialization depth (depth is now 100 and due to this now being a standalone package, we can pretty safely increase this depth as well based on user feedback as needed). This SDK package is still in public preview, but the plan is to GA it fairly soon. In any case, I wanted to give y'all a heads up in case you want to try it out and provide us with feedback. All the details should be in the announcement above. Thank you! |
Description
Consider the following code in orchestration function:
Activity function Test1 takes list of Azure management groups and returns it to output (just a sample to demonstrate)
Activity function Test2 is expected to take the list and process it
Code in Test2 however does not get list of Management groups, but rather list of objects of System.Colections.Hashtable, that is not possible to work with (DisplayName or other props of Management group not propagated from the objects)
List of Management groups is serializable to JSON, so I would expect that it can be passed between activity functions as needed, as long as it can be serialized.
Expected behavior
Complex output of activity function shall be usable as input in chained activity function
Actual behavior
Complex output of activity function is not usable in chained activity function
Relevant source code snippets
see above
Known workarounds
so far only simple objects seem to be able to be passed between activity functions. Workaround is to store complex objects outside of function, e.g. in storage blob.
App Details
The text was updated successfully, but these errors were encountered: