[Python] azure function app python - Encountered an error (InternalServerError) from host...

Discussão em 'Python' iniciado por Stack, Janeiro 31, 2025.

  1. Stack

    Stack Membro Participativo

    I have created a very simple azure function in python but keep getting folowing error when trying to run it. I cant find anything in app insights:

    [​IMG]

    Environment variables:

    [
    {
    "name": "APPINSIGHTS_PROFILERFEATURE_VERSION",
    "value": "1.0.0",
    "slotSetting": false
    },
    {
    "name": "APPINSIGHTS_SNAPSHOTFEATURE_VERSION",
    "value": "1.0.0",
    "slotSetting": false
    },
    {
    "name": "APPLICATIONINSIGHTS_CONNECTION_STRING",
    "value": "InstrumentationKey=xx-xx-xx-xx-f435e1b90ad8;IngestionEndpoint=https://westeurope-5.in.applicationinsights.azure.com/;LiveEndpoint=https://westeurope.livediagnostics.monitor.azure.com/;ApplicationId=xx-xx-xx-xx-xx",
    "slotSetting": false
    },
    {
    "name": "ApplicationInsightsAgent_EXTENSION_VERSION",
    "value": "~3",
    "slotSetting": false
    },
    {
    "name": "AzureWebJobsStorage__accountName",
    "value": "stdnaexchangeratesdev",
    "slotSetting": false
    },
    {
    "name": "AzureWebJobsStorage__blobServiceUri",
    "value": "https://xx.blob.core.windows.net/",
    "slotSetting": false
    },
    {
    "name": "BUILD_FLAGS",
    "value": "UseExpressBuild",
    "slotSetting": false
    },
    {
    "name": "ENABLE_ORYX_BUILD",
    "value": "true",
    "slotSetting": false
    },
    {
    "name": "FUNCTIONS_EXTENSION_VERSION",
    "value": "~4",
    "slotSetting": false
    },
    {
    "name": "FUNCTIONS_WORKER_RUNTIME",
    "value": "python",
    "slotSetting": false
    },
    {
    "name": "SCM_DO_BUILD_DURING_DEPLOYMENT",
    "value": "1",
    "slotSetting": false
    },
    {
    "name": "WEBSITE_USE_PLACEHOLDER_DOTNETISOLATED",
    "value": "1",
    "slotSetting": false
    },
    {
    "name": "XDG_CACHE_HOME",
    "value": "/tmp/.cache",
    "slotSetting": false
    },
    {
    "name": "XDT_MicrosoftApplicationInsights_Mode",
    "value": "recommended",
    "slotSetting": false
    }
    ]


    Code:

    import azure.functions as func
    import datetime
    import logging
    import requests

    app = func.FunctionApp()
    @app.timer_trigger(schedule="0 * * * * *", arg_name="myTimer", run_on_startup=True,
    use_monitor=False)
    def timer_trigger(myTimer: func.TimerRequest) -> None:

    if myTimer.past_due:
    print('The timer is past due!')

    print("Hello, World!")


    Configurations: [​IMG]

    Any pointers how to trouble shoot this?

    Continue reading...

Compartilhe esta Página