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

Function indexing fails when endpoint is not reachable even when function is disabled #166

Open
fdipuma opened this issue Aug 18, 2021 · 3 comments

Comments

@fdipuma
Copy link

fdipuma commented Aug 18, 2021

Hello!

I've got two functions (with different input bindings) both for RabbitMQ and Azure Service Bus, and I aim to enable/disable the bindings based on where the function is deployed, e.g.:

  • When the function is deployed in production on consumption plan, disable RabbitMQ trigger and enable Azure Service Bus
  • When testing locally, enable RabbitMQ and disable ASB
  • When on Premium plan, enable both.

The issue is that it seems impossible to disable the RabbitMQ input trigger since the RabbitMQ.Client is created before the function enabled state is checked.

Tried with:

  • Using [Disable] attribute
  • Putting AzureWebJob.FUNCTION_NAME.Disabled settings to "true"
  • Putting a fake connection string pointing to localhost

But the result is the same:

The 'HandleEventFromRabbitMq' function is in error: Microsoft.Azure.WebJobs.Host: Error indexing method 'HandleEventFromRabbitMq'. RabbitMQ.Client: None of the specified endpoints were reachable. RabbitMQ.Client: One or more errors occurred. (Connection failed). RabbitMQ.Client: Connection failed. System.Private.CoreLib: No connection could be made because the target machine actively refused it. 127.0.0.1:5672.

Is there any workaround?

@Blackleones
Copy link

Same problem using Azure Function V4 in-process. Is there any news about this issue?

sample code

public class Function2
{
    [FunctionName("Function2")]
    public void Run([RabbitMQTrigger("myqueue", ConnectionStringSetting = "myconnectionstring")]string myQueueItem, ILogger log)
    {
        log.LogInformation($"C# Queue trigger function processed: {myQueueItem}");
    }
}

local.settings.json

{
    "IsEncrypted": false,
    "Values": {
        "AzureWebJobsStorage": "UseDevelopmentStorage=true",
        "FUNCTIONS_WORKER_RUNTIME": "dotnet",
        "AzureWebJobs.Function2.Disabled": true
  }
}

@srobertson72
Copy link

I have tried the exact same use case (trying to switch between RabbitMQ for local and Azure Service Bus for hosted deployment) and have found the same issue......Any news on this issue?

@MauriceVDHeuvel
Copy link

I also encountered the same behaviour having the same use-case. Is there a workaround or fix in the pipeline. For now i'm just ignoring the exception being thrown.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants