Corey
Corey

Reputation: 298

Azure Functions .NET 5.0 Issue with Triggers

Based on these two sites I created an Azure Function for .NET 5.0:

(Preview) Creating Azure Functions using .NET 5

Use Azure Functions with .NET 5

Everything compiles, but when I publish it detects the following:

Getting site publishing info...
Creating archive for current directory...
Uploading 16.64 MB
Upload completed successfully.
Deployment completed successfully.
Syncing triggers...
Functions in AppDev:
     OrderSubmitterFunction - [No Trigger Found]
     OtherSubmitterFunction - [No Trigger Found]

In one of my function classes:

[Function(nameof(OrderSubmitterFunction))]
public async Task Run([QueueTrigger("orders", Connection = "AzureWebJobsStorage")]string myQueueItem, ILogger log)

and another:

[Function(nameof(OtherSubmitterFunction))]
public async Task Run([BlobTrigger(containerName + "/{name}", Connection = "AzureWebJobsStorage")]Stream myBlob, string name, ILogger log)

I suspect the above is the issue as these trigger attributes do not seem to get picked up. The functions do however get noticed.

For reference my start up class is:

static Task Main(string[] args)
{
    var config = new ConfigurationBuilder()
        .SetBasePath(Directory.GetCurrentDirectory())
        .AddJsonFile("local.settings.json", optional: true, reloadOnChange: true)
        .AddEnvironmentVariables()
        .Build();

    var host = new HostBuilder()
        .ConfigureAppConfiguration(configurationBuilder =>
        {
            configurationBuilder.AddCommandLine(args);
        })
        .ConfigureFunctionsWorkerDefaults()
        .ConfigureServices(services =>
        {
            services.AddLogging();
            services.AddDbContext<Context>(opts =>
            {
                var conn = config.GetConnectionString("Context");
                opts.UseSqlServer(conn);
            });
        })
        .Build();

    return host.RunAsync();
}

Does anyone notice anything with the above?

Upvotes: 0

Views: 468

Answers (1)

Ivan Glasenberg
Ivan Glasenberg

Reputation: 29985

This is a known issue and you can find it in github. I have the same issue during publish:

enter image description here

Since the function can work without any impacts, we can ignore it at this time.

By the way, we should follow the official doc 1 or official doc 2 to create Azure Function for .NET 5.0.

Upvotes: 1

Related Questions