azure-webjobs-sdk-extensions icon indicating copy to clipboard operation
azure-webjobs-sdk-extensions copied to clipboard

ExternalFileTrigger not usable with Visual Studio Functions SDK

Open brandonh-msft opened this issue 7 years ago • 2 comments

While attempting to use the External File Trigger on a locally-developed (VS 2017 Preview) Azure Function, I received error messages I was unable to work around.

Repro steps

Use the following function definition:

public static class FtpToBlobStorageOnFileChanged
{
    [FunctionName("FtpToBlobStorageOnFileChanged")]
    public static void Run(
        [ApiHubFileTrigger(@"ChangeFeedFTPsource", "/", FileWatcherType.Created, pollIntervalInSeconds: 3)]object inputFile,
        TraceWriter log,
        [Blob(@"blobs-from-ftp/{rand-guid}", Connection = @"ChangeFeedFTPblobsStorage")]out string blobName)
    {
        log.Info(inputFile?.ToString() ?? @"[NULL]");
        log.Info($"C# Timer trigger function executed at: {DateTime.Now}");

        blobName = Guid.NewGuid().ToString();
    }
}

where the ChangeFeedFTPsource is an FTP server drop folder and ChangeFeedFTPblobsStorage is an Azure Blob Storage instance with a container named blobs-from-ftp.

Hit F5 to debug your Azure Function.

Expected behavior

Azure Function debugging starts, and the function executes when a file is dropped in the FTP folder.

Actual behavior

Function debugging fails to start, errors out with the message: FtpToBlobStorageOnFileChange: Can't figure out which ctor to call.

Known workarounds

None.

Related information

<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.ApiHub" Version="1.0.0-beta6" />    
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.DocumentDB" Version="1.1.0-beta4" />    
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="1.0.5" />

brandonh-msft avatar Oct 04 '17 18:10 brandonh-msft

Looks like you are missing the app setting name which contains the connection string to your FTP server. that should be the first parameter. more samples here: https://github.com/Azure/azure-webjobs-sdk-extensions/blob/v2.x/test/WebJobs.Extensions.Tests/Extensions/ApiHub/ApiHubFileTestJobs.cs

safihamid avatar Nov 17 '17 05:11 safihamid

that's on line 5... no?

brandonh-msft avatar Nov 20 '17 19:11 brandonh-msft