Skip to content

Commit 8d28e82

Browse files
committed
added check to see if Get-CurrentActivityForInvocation is available
1 parent 6c92a83 commit 8d28e82

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/AzureFunctions.PowerShell.Durable.SDK.psm1

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,12 @@ function Get-TraceHeaders {
142142
return @{} # Return an empty headers object
143143
}
144144

145+
# Check if Get-CurrentActivityForInvocation is available
146+
if (-not (Get-Command -Name Get-CurrentActivityForInvocation -ErrorAction SilentlyContinue)) {
147+
Write-Warning "Get-CurrentActivityForInvocation is not available. Skipping call."
148+
return @{} # Return an empty headers object
149+
}
150+
145151
$activityResponse = Get-CurrentActivityForInvocation -InvocationId $invocationId
146152
$activity = $activityResponse.activity
147153

0 commit comments

Comments
 (0)