none
Blob Triggered Azure Function doesn't work deployed but works locally. And NO SIGN of any error

    Question

  • Here's my azure function made with VS2017 15.6.0 Preview 1.1 - https://github.com/alvipeo/azfunc.git. It perfectly works when I run it locally with VS.

    I created a CI/CD pipeline with VSTS. No errors there too (if you need details I can share), all deployed successfully.

    I set all settings in Azure, so it should work when deployed. But it doesn't. And what's more, I see NO SIGN of errors or any log records anywhere (but I enabled everything in the Diagnostics and I have App Insights).

    This is really bad experience building Azure Functions. Please help!

    Tuesday, January 2, 2018 6:23 PM

Answers

  • ah ok, I know what happened, you need 2.0 runtime whereas the functionApp is running 1.0

    you can tell by the following

    1. in your csproj, you can see netstandard2.0 instead of net46

    2. your local host runtime version is 2.0.XXXX

    you just need to change the appsetting FUNCTIONS_EXTENSION_VERSION=~2

    • Marked as answer by Alex Beloff Friday, January 5, 2018 12:32 AM
    Thursday, January 4, 2018 12:31 AM
  • ok, I used Blob Storage account (not General Purpose account). That's why it couldn't connect.

    First, thank you very much for your help!

    But guys, please fix this mess with functions made in VS2017 and deployed with VSTS. And please fix Logs view in the Portal for function. I still see nothing at the moment, so I use Kudu.

    Also, fix this FUNCTIONS_EXTENSION_VERSION=~2 thing. And remove that stupid 'Upgrade to v.1' link.

    • Marked as answer by Alex Beloff Friday, January 5, 2018 12:33 AM
    Friday, January 5, 2018 12:32 AM

All replies

  • what do you observe when you say "it does not work"? is your function not being triggered? what can see from function portal log streams?

    did you add connection string (https://github.com/alvipeo/azfunc/blob/master/CheckNewBlob/CheckNewBlob.cs#L15) to your Azure function app? 

    Tuesday, January 2, 2018 7:13 PM
  • I had it in Application Settings section. Now moved it to Connection Strings. Restarted app. No change. I tried couple of times.

    Now, there are these 2 settings:

    • AzureWebJobsStorage
    • AzureWebJobsDashboard

    Where should they be set? Application Settings or Connection Strings?

    Does all this even really matter?

    I still have NO LOGS anywhere...

    Wednesday, January 3, 2018 1:25 AM
  • they should be in application settings : https://docs.microsoft.com/en-us/azure/azure-functions/functions-app-settings

    can you share your functionApp name? I want to take a look

    Wednesday, January 3, 2018 3:53 AM
  • Sure - intr.azurewebsites.net
    Wednesday, January 3, 2018 4:11 AM
  • I think your deployment looks correct, but when I check your logs I see the following:

     Starting Host (HostId=intr, Version=1.0.11388.0, ProcessId=4008, Debug=True, ConsecutiveErrors=0, StartupCount=1, FunctionsExtensionVersion=~1)
     Development settings applied
     No job functions found. Try making your job classes and methods public. If you're using binding extensions (e.g. ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. config.UseServiceBus(), config.UseTimers(), etc.).
     Job host started

    looks like we did not discover checkNewBlob...I am not sure why, it could be version related, you mentioned that you were able to test it locally, was it running "Version=1.0.11375.0" in visual studio?

    Wednesday, January 3, 2018 11:05 PM
  • When I run it locally I see this: 

    Starting Host (HostId=desktop11lnjml-498098138, Version=2.0.11353.0, ProcessId=15436, Debug=False, Attempt=0, FunctionsExtensionVersion=)

    How can I specify Version with VSTS?

    As you may see in my repo I don't have any binding extensions except blob trigger.

    • Edited by Alex Beloff Thursday, January 4, 2018 12:13 AM
    Wednesday, January 3, 2018 11:35 PM
  • ah ok, I know what happened, you need 2.0 runtime whereas the functionApp is running 1.0

    you can tell by the following

    1. in your csproj, you can see netstandard2.0 instead of net46

    2. your local host runtime version is 2.0.XXXX

    you just need to change the appsetting FUNCTIONS_EXTENSION_VERSION=~2

    • Marked as answer by Alex Beloff Friday, January 5, 2018 12:32 AM
    Thursday, January 4, 2018 12:31 AM
  • I changed it to ~2. But that didn't help. I still have no idea where to find ANY logs. But I opened Streaming logs and they show nothing except 'No new trace in the past 1 min(s)'.

    Now, in the portal I see now the message 'A new version of Azure Functions is available. To upgrade, click here'. If I click it turns the version back to ~1 which is weirdest upgrade I've ever seen :)

    Anyways, the function still doesn't work :(

    Thursday, January 4, 2018 9:40 AM
  • you can see host logs if you go to the scm site (intr.scm.azurewebsites.net) and follow this file path

    D:\home\LogFiles\Application\Functions\Host

    here is what I see after you switched to the correct runtime:

    2018-01-04T09:31:05.044 Generating 1 job function(s)
    2018-01-04T09:31:05.381 Starting Host (HostId=intr, Version=2.0.11415.0, ProcessId=3732, Debug=True, ConsecutiveErrors=0, StartupCount=1, FunctionsExtensionVersion=~2)
    2018-01-04T09:31:09.245 Host lock lease acquired by instance ID '1fcb53910e8f2869c577f537072a3271'.
    2018-01-04T09:31:34.776 A ScriptHost error has occurred
    2018-01-04T09:31:34.824 Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexingException : Error indexing method 'CheckNewBlob.Run' ---> Microsoft.WindowsAzure.Storage.StorageException : An error occurred while sending the request. ---> System.Net.Http.HttpRequestException : An error occurred while sending the request. ---> System.Net.Http.WinHttpException : The server name or address could not be resolved

    the good news is that your function is the being discovered,

    looking at the error message I am suspecting that your blob trigger is binded to a blob-storage account? (https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-storage-blob)


    Thursday, January 4, 2018 11:26 PM
  • Oh! We're getting close! Yes, it is bound to storage account. I wonder why it can't access it. Let me see...
    Thursday, January 4, 2018 11:45 PM
  • ok, I used Blob Storage account (not General Purpose account). That's why it couldn't connect.

    First, thank you very much for your help!

    But guys, please fix this mess with functions made in VS2017 and deployed with VSTS. And please fix Logs view in the Portal for function. I still see nothing at the moment, so I use Kudu.

    Also, fix this FUNCTIONS_EXTENSION_VERSION=~2 thing. And remove that stupid 'Upgrade to v.1' link.

    • Marked as answer by Alex Beloff Friday, January 5, 2018 12:33 AM
    Friday, January 5, 2018 12:32 AM