0

I’ve created a basic timer_trigger Azure Function using Visual Studio Code using Python. It works perfectly in my local environment. However, after deploying it to Azure, the function does not run at all.

When I try to test or run the function through the Azure Portal, I receive the following error message:

Function triggers synchronization failed due to Response status code does not indicate success: 500 (Internal Server Error)

The deployment itself completes without any issues, and the function appears in the portal, but the trigger doesn’t execute automatically or manually, I tried using HTTP function as well but same results.

(I am not using pay as you go, using free 200$ credit subscription plan) Has anyone encountered this issue before or know what could be causing this error?

Any help or guidance would be greatly appreciated!

Thank you. Error it shows

Output:

:23:54 AM func-afaq: Uploaded package to storage blob. Deployment is partially successful from here.
2:23:54 AM func-afaq: [RemoveWorkersStep] starting.
2:23:55 AM func-afaq: RemoveAllWorkers, statusCode = NoContent
2:23:55 AM func-afaq: Reset all workers was successful.
2:23:55 AM func-afaq: [SyncTriggerStep] starting.
2:23:55 AM func-afaq: Waiting 60 seconds for the workers to recycle with deployed content.
2:24:55 AM func-afaq: [CleanUpStep] starting.
2:24:55 AM func-afaq: Cleaned the source packages directory.
2:24:55 AM func-afaq: Cleaned the result artifact directory.
2:24:55 AM func-afaq: Finished deployment pipeline.
2:24:57 AM func-afaq: FunctionHostSyncTrigger, statusCode = InternalServerError
2:25:02 AM func-afaq: Querying triggers...

function_app.py:

import logging
import azure.functions as func

app = func.FunctionApp()

@app.timer_trigger(schedule="0 * * * * *", arg_name="myTimer", run_on_startup=False,
              use_monitor=False) 
def timer_trigger(myTimer: func.TimerRequest) -> None:
    if myTimer.past_due:
        logging.info('The timer is past due!')

    logging.info('Python timer trigger function executed.')

host.json:

{
  "version": "2.0",
  "logging": {
    "applicationInsights": {
      "samplingSettings": {
        "isEnabled": true,
        "excludedTypes": "Request"
      }
    }
  },
  "extensionBundle": {
    "id": "Microsoft.Azure.Functions.ExtensionBundle",
    "version": "[4.*, 5.0.0)"
  }
}

local.setting.json:

{
  "IsEncrypted": false,
  "Values": {
    "AzureWebJobsStorage": "UseDevelopmentStorage=true",
    "FUNCTIONS_WORKER_RUNTIME": "python",
    "AzureWebJobsFeatureFlags": "EnableWorkerIndexing"
    
  }
}

I tried deploying a simple template given by vs code when i created function it ran locally with no issues, then after deployment it gave me : Error while loading Ask questions and use troubleshooting tools to investigate these errors.Diagnose and solve problems Encountered an error (InternalServerError) from host runtime

3
  • When you see a 500 error the first thing you do is go to the server error log to find the root cause of the problem. You do that before posting a question here, because if you don't, the first comment you'll get is 'What's in the server error log?' Commented Apr 15 at 23:26
  • @Afaq Bukhari, Which plan you are using for function app like consumption plan? Commented Apr 16 at 5:57
  • If you are using premium plan, Enable Always On in configuration section. Commented Apr 16 at 7:00

1 Answer 1

0

Function triggers synchronization failed due to Response status code does not indicate success: 500 (Internal Server Error)

If you are using premium plan can enable Always On in the configuration section. by following Settings>Configuration > General settings>Always On

  • Check the version of azure function must be a latest version.
  • After changed anything in portal restart the function app and then redeploy the function.
  • Check the Application Insights for detailed logging like the cause of an error.

enter image description here

I have created the Timer trigger function with runtime stack Python by using Consumption plan and ran successfully in local.

enter image description here

I have deployed the Time trigger function into azure portal. By checking the invocations in the function get the status like below:

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.