1

I have the following setup to test my Durable Function.

public class TestDurableFunction
{
    private readonly ITestRepository _testRepository;

    public TestDurableFunction(ITestRepository testRepository)
    {
        _testRepository = testRepository; // needed for later use
    }
    
    [FunctionName("TimerTrigger")]
    public async Task Run([TimerTrigger("0 1 * * *", RunOnStartup = true)] TimerInfo myTimer, [DurableClient] IDurableClient starter, ILogger logger)
    {
        try
        {
            await starter.StartNewAsync("OrchestrateSavings", null);
        }
        catch (Exception exception)
        {
            logger.LogFunctionError(nameof(Run), nameof(TestDurableFunction), exception);
        }
    }

    [FunctionName("OrchestrateTest")]
    public async Task<int> OrchestrateTest([OrchestrationTrigger] IDurableOrchestrationContext context)
    {
        await Task.CompletedTask;
        return 10;
    }
}

When I start this function locally, then the TimerTrigger function starts with no problems. This function then calls my OrchestrateTest Durable Function.

But that immediately throws the following error in the Command Prompt window:

Microsoft.Azure.WebJobs.Script.WebHost: Unable to load metadata for function 'OrchestrateTest'. Function 'OrchestrateTest (Orchestrator)' was aborted. Reason: An internal error occurred while attempting to execute this function. The execution will be aborted and retried. Details: System.NullReferenceException: Object reference not set to an instance of an object.

Anyone any idea what the issue could be?

2
  • is your issue resolved with provided answer? Commented Jul 22, 2021 at 10:31
  • Anyone searching for this error message, you get the same message if you missout [FunctionName("xxx")] and have RunOnStartup = True on the method Commented May 18, 2023 at 20:59

1 Answer 1

2

As per your code the orchestrator function you are invoking is OrchestrateSavings; however there is not orchestrator function registered with that name. As per posted code the orchestrator function name is OrchestrateTest. So change the line to

await starter.StartNewAsync("OrchestrateTest", null);

in the Run method.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.