none
QueueTrigger not working when published from Visual Studio 2017 RRS feed

  • Question

  • I have created a Function App using the QueueTrigger template from within the portal and it successfully responds to new queue messages.

    However when attempting to perform the same operation via visual studio and publishing to azure i notice that new queue messages are ignored.

    I have used the consumption service plan in both instances.

    On closer inspection I notice that within the VS published instance, the function.json file is missing the direction attribute.

    But probably more importantly I notice within the appsettings of the VS published instance the storage connection string is using a newly created account name.

    If I attempt to update the app settings to use the correct connection string I receive the following error within the portal:

    Error: The function runtime is unable to start. Please check the runtime logs for any errors or try again later. Session Id: 25d9f461c4fe44d18865aec59f133576 Timestamp: 2017-12-04T21:34:18.250Z

    It would appear that you are able to specify the storage account to use whilst creating a function app via the portal, but not when publishing via visual studio.

    Monday, December 4, 2017 10:02 PM

Answers

  • ok i've worked it out.

    it would appear that the storage account dropdown must have been available with a previous version of visual studio or the azure sdk.

    i am now running:

    visual studio 2017 15.5.0

    azure development with all optional packages selected

    azure functions and web jobs tools 15.0.31201.0

    now, when publishing my function app i see an additional option on the final step before publishing: manage application settings

    This option gives me the option of overridding the connection strings.....

    Publishing after making these amendments enables my function app to respond to queuetriggers correctly

    • Marked as answer by David Buckell Friday, December 8, 2017 7:04 PM
    Friday, December 8, 2017 7:03 PM

All replies

  • Can you share with us your function app name? If you don't feel comfortable sharing that publicly, you can use this method: https://github.com/Azure/azure-webjobs-sdk-script/wiki/Sharing-Your-Function-App-name-privately
    Tuesday, December 5, 2017 9:16 PM
  • i've since deleted it as i've tried republishing several times.

    all it does is the default behaviour:

    [FunctionName("Queue")]
    public static void Run([QueueTrigger("msgtest2", Connection = "AzureWebJobsStorage")]string myQueueItem, TraceWriter log)
    {
    log.Info($"C# Queue trigger function processed: {myQueueItem}");
    }



    Tuesday, December 5, 2017 9:18 PM
  • Try publishing again, and give us the Session Id of the error again. This way we can see the error logs and help identify your error.
    Tuesday, December 5, 2017 9:24 PM
  • republished, function name: queuetrigger

    tested and it ignored queue message.

    updated following appsettings so use correct connection strings:

    WEBSITE_CONTENTAZUREFILECONNECTIONSTRING

    AzureWebJobsDashboard

    AzureWebJobsStorage

    then i receive the following exception

    Error:

    The function runtime is unable to start. Please check the runtime logs for any errors or try again later.

    Session Id: aa816b96d251489bb50493445b9e79b9

    Timestamp: 2017-12-05T21:32:58.635Z

    also get this error within chrome dev tools:

    main.92ba6981163ba5f252c3.bundle.js:1 [FunctionEdit] - TypeError: Cannot read property 'context' of undefined

    Tuesday, December 5, 2017 9:34 PM
  • "But probably more importantly I notice within the appsettings of the VS published instance the storage connection string is using a newly created account name.

    "AzureWebJobsStorage" is a storage connection string used by Azure function runtime for metadatas, if you do not specify it during publish time, we will create a new one, here's a screenshot from https://docs.microsoft.com/en-us/azure/azure-functions/functions-develop-vs 

    Azure local runtime

    here are two possible solutions

    1. you can either set this storage account to the one where your queue is during publish (of cause your function metadata will also be saved there)

    2. you can change the connection string name to something other than "AzureWebJobsStorage" and update it in app setting at anytime

    let me know if you guess was correct...


    Thursday, December 7, 2017 7:28 PM
  • Hi,

    Thanks for the reply. Yes I can see what the issue is.

    Trouble is I do not see that storage account dropdown when I attempt to publish for some reason.

    Am I missing a Vs extension?

    Thursday, December 7, 2017 7:32 PM
  • you can check your VS settings

    Prerequisites

    Azure Functions Tools is included in the Azure development workload of Visual Studio 2017 version 15.4, or a later version. Make sure you include the Azure development workload in your Visual Studio 2017 installation:

    Install Visual Studio 2017 with the Azure development workload

    Thursday, December 7, 2017 7:38 PM
  • Also important to check that the Azure Functions and Web Jobs tools are up to date. I should note that to use the latest version of these tools as of now, you need VS 15.5.

    

    Thursday, December 7, 2017 7:55 PM
  • yes i have both of those installed already, although my azure functions and web jobs tools appears a minor version behind with no option to update.

    and still no storage account option:

    Thursday, December 7, 2017 8:36 PM
  • can you try clicking the checkbox for "Azure Development" in your first screenshot?
    Thursday, December 7, 2017 8:51 PM
  • i had previously installed that but have just uninstalled and reinstalled as a test.

    i noticed i had the option of installing the same version of azure functions and web jobs tools following the uninstall, but the install of this extension failed as i needed to install azure development first.

    now having installed azure development, the azure functions extension has been auto installed but with the same version as i had before and not the latest as per your screenshot.

    i still do not see the storage account dropdown when publishing.

    Thursday, December 7, 2017 9:20 PM
  • have just spotted ver 15.0.31201.0 in extensions and updates -> updates -> visual studio marketplace.

    it wasn't there before.  have updated but still no sign of the storage account dropdown on publish

    Thursday, December 7, 2017 9:29 PM
  • ok i've worked it out.

    it would appear that the storage account dropdown must have been available with a previous version of visual studio or the azure sdk.

    i am now running:

    visual studio 2017 15.5.0

    azure development with all optional packages selected

    azure functions and web jobs tools 15.0.31201.0

    now, when publishing my function app i see an additional option on the final step before publishing: manage application settings

    This option gives me the option of overridding the connection strings.....

    Publishing after making these amendments enables my function app to respond to queuetriggers correctly

    • Marked as answer by David Buckell Friday, December 8, 2017 7:04 PM
    Friday, December 8, 2017 7:03 PM