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

Still can't seem to pass complex output to activity functions #67

Open
noaht8um opened this issue Aug 24, 2023 · 1 comment
Open

Still can't seem to pass complex output to activity functions #67

noaht8um opened this issue Aug 24, 2023 · 1 comment
Labels
Enhancement New feature or request Needs: Author Feedback Waiting for the author of the issue to respond to a question P3 Priority 3

Comments

@noaht8um
Copy link

Related Issue: Azure/azure-functions-durable-extension#1922

If I build up a ps object with sub-objects in an orchestration function and send that to an activity function, it ends up as a hashtable on the other side:

$InputData = [PSCustomObject]@{
            Data = $Data
            Documents = $Documents
            SyncDataType = $SyncDataType
        }
Invoke-DurableActivity -FunctionName 'Sync-DataWithDocuments' -Input $InputData

Maybe this is just a limitation but I want to be sure before I use workarounds. I can get it to work if I do the following:

$InputData = [PSCustomObject]@{
            Data = $Data
            Documents = $Documents
            SyncDataType = $SyncDataType
        }
Invoke-DurableActivity -FunctionName 'Sync-DataWithDocuments' -Input ($InputData | ConvertTo-Json -Depth 100)

Then in the activity function

function Sync-DataWithDocuments {
    Param($Object)
    $Object = $Object | ConvertTo-Json -Depth 100 | ConvertFrom-Json
}
@davidmrdavid
Copy link
Collaborator

Hi @noaht8um:

Thanks for reaching out. I'm aware of at least 1 serialization bug related to Activity invocations, but I think this particular case is working.

For the following orchestrator code:

param($Context)

$output = @()

$InputData = [PSCustomObject]@{
            Data = "Tokyo"
            Documents = "Seattle"
            SyncDataType = "London"
        }

$output += Invoke-DurableActivity -FunctionName 'Hello' -Input $InputData

$output

And this Activity

param($name)

Write-Host $name.GetType()
Write-Host $name.Keys
Write-Host $name.Values

"Hello $name!"

I get the following trace:

[2023-09-01T21:22:36.779Z] Executing 'Functions.Hello' (Reason='(null)', Id=53f33107-7a1a-496e-9c07-e6d57d7ce782)
[2023-09-01T21:22:36.814Z] INFORMATION: System.Collections.Hashtable
[2023-09-01T21:22:36.816Z] INFORMATION: SyncDataType Documents Data
[2023-09-01T21:22:36.818Z] INFORMATION: London Seattle Tokyo
[2023-09-01T21:22:36.823Z] Executed 'Functions.Hello' (Succeeded, Id=53f33107-7a1a-496e-9c07-e6d57d7ce782, Duration=47ms)

In the trace above, I can see the keys and values of the hashmap. Is this what you're seeing on your end as well?

@lilyjma lilyjma added P3 Priority 3 question The issue doesn't require a change to the product in order to be resolved. Enhancement New feature or request Needs: Author Feedback Waiting for the author of the issue to respond to a question and removed question The issue doesn't require a change to the product in order to be resolved. labels Jan 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request Needs: Author Feedback Waiting for the author of the issue to respond to a question P3 Priority 3
Projects
None yet
Development

No branches or pull requests

3 participants