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

Get-DurableStatus still causing Error 401 (Unauthorized) in Azure Function App #73

Open
tjgruber opened this issue May 3, 2024 · 1 comment

Comments

@tjgruber
Copy link

tjgruber commented May 3, 2024

This issue is still happening in Azure Durable Functions via HTTP starter function.

Apparently this has been fixed, but it does not actually seem to be, see:

To rule out any issues in my own code & functions, I also tested using Microsoft's own examples, showing the issue persists:

Using template:

  • DurableClient as regAPStart
  • DurableOrchestrator as regAPOrch
  • DuragleActivity as regAPAct

The orchestrator and activity are running just fine.

The Starter works fine until it gets to the following line:
$Status = Get-DurableStatus -InstanceId $InstanceId

Starter returns:

2024-05-03T18:35:58Z   [Information]   INFORMATION: DurableClient started
2024-05-03T18:35:58Z   [Information]   INFORMATION: Started orchestration with ID = 'b937fc9d-a34d-4407-a876-c9cdd2f18c2e', FunctionName = 'regAPOrch'
2024-05-03T18:35:58Z   [Error]   EXCEPTION: Response status code does not indicate success: 401 (Unauthorized).

Orchestrator returns:

2024-05-03T18:39:51Z   [Information]   INFORMATION: DurableOrchestrator: started. Input: Hello
2024-05-03T18:39:51Z   [Information]   INFORMATION: DurableOrchestrator: finished.
2024-05-03T18:39:51Z   [Information]   OUTPUT: Hello Tokyo
2024-05-03T18:39:51Z   [Information]   <id>: Function 'regAPOrch (Orchestrator)' completed.

Activity returns:

2024-05-03T18:39:41Z   [Information]   INFORMATION: DurableActivity(Tokyo) started
2024-05-03T18:39:51Z   [Information]   INFORMATION: DurableActivity(Tokyo) finished
2024-05-03T18:39:51Z   [Information]   Executed 'Functions.regAPAct'
@andystaples
Copy link
Collaborator

When digging into this issue, it was discovered that this is a result of not importing the external module explicitly into your function app by adding a line like this somewhere in your app (preferably profile.ps1)

Import-Module AzureFunctions.PowerShell.Durable.SDK

If the module is not imported, the function definitions from this module are not loaded and instead the ones bundled with the PowerShell worker are used. I have opened a PR on the PowerShell worker to fix this behavior in the bundled module, but for now you can resolve this by adding the import statement.

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

2 participants