skip to Main Content

I am using Python 3.9 (Python programming model v2) and I created an HTTP Function based on the official example. When I deploy using visual studio code, I get this output message and I can’t figure out how to call the function. Everything works just fine in my local debugging environment. When I deploy, the app is created successfully, the files are copied and all the requirements are installed, but the functions don’t show up in the resources tab in visual studio or in the web portal.

FYI – in the deploy output I changed my actual app name to "appname".

8:21:09 PM appname: Starting deployment...
8:21:11 PM appname: Creating zip package...
8:21:11 PM appname: Zip package size: 4.7 kB
8:21:12 PM appname: Fetching changes.
8:21:13 PM appname: Cleaning up temp folders from previous zip deployments and extracting pushed zip file /tmp/zipdeploy/81dc1e42-91a5-41cb-aece-4630ea2b692c.zip (0.00 MB) to /tmp/zipdeploy/extracted
8:21:15 PM appname: Updating submodules.
8:21:16 PM appname: Preparing deployment for commit id '1c897f2e-2'.
8:21:16 PM appname: PreDeployment: context.CleanOutputPath False
8:21:16 PM appname: PreDeployment: context.OutputPath /home/site/wwwroot
8:21:16 PM appname: Repository path is /tmp/zipdeploy/extracted
8:21:16 PM appname: Running oryx build...
8:21:16 PM appname: Command: oryx build /tmp/zipdeploy/extracted -o /home/site/wwwroot --platform python --platform-version 3.9.7 -p packagedir=.python_packages/lib/site-packages
8:21:17 PM appname: Operation performed by Microsoft Oryx, https://github.com/Microsoft/Oryx
8:21:17 PM appname: You can report issues at https://github.com/Microsoft/Oryx/issues
8:21:17 PM appname: Oryx Version: 0.2.20210120.1, Commit: 66c7820d7df527aaffabd2563a49ad57930999c9, ReleaseTagName: 20210120.1
8:21:17 PM appname: Build Operation ID: |uRPGYFCvdWE=.f9456c76_
8:21:17 PM appname: Repository Commit : 1c897f2e-229f-463a-9f2e-a3357f68a89b
8:21:17 PM appname: Detecting platforms...
8:21:18 PM appname: Detected following platforms:
8:21:18 PM appname:   python: 3.9.7
8:21:18 PM appname: Version '3.9.7' of platform 'python' is not installed. Generating script to install it...
8:21:18 PM appname: Source directory     : /tmp/zipdeploy/extracted
8:21:18 PM appname: Destination directory: /home/site/wwwroot
8:21:18 PM appname: Downloading and extracting 'python' version '3.9.7' to '/tmp/oryx/platforms/python/3.9.7'...
8:21:20 PM appname: Downloaded in 2 sec(s).
8:21:20 PM appname: Verifying checksum...
8:21:21 PM appname: Extracting contents...
8:21:24 PM appname: Done in 6 sec(s).
8:21:24 PM appname: Python Version: /tmp/oryx/platforms/python/3.9.7/bin/python3.9
8:21:24 PM appname: Running pip install...
8:21:25 PM appname: [04:21:25+0000] Collecting azure-functions
8:21:25 PM appname: [04:21:25+0000]   Downloading azure_functions-1.12.0-py3-none-any.whl (160 kB)
8:21:25 PM appname: [04:21:25+0000] Collecting discord
8:21:25 PM appname: [04:21:25+0000]   Downloading discord-2.1.0-py3-none-any.whl (1.1 kB)
8:21:25 PM appname: [04:21:25+0000] Collecting requests
8:21:25 PM appname: [04:21:25+0000]   Downloading requests-2.28.1-py3-none-any.whl (62 kB)
8:21:25 PM appname: [04:21:25+0000] Collecting datetime
8:21:25 PM appname: [04:21:25+0000]   Downloading DateTime-4.7-py2.py3-none-any.whl (52 kB)
8:21:25 PM appname: [04:21:25+0000] Collecting discord.py>=2.1.0
8:21:25 PM appname: [04:21:25+0000]   Downloading discord.py-2.1.0-py3-none-any.whl (1.1 MB)
8:21:26 PM appname: [04:21:26+0000] Collecting charset-normalizer<3,>=2
8:21:26 PM appname: [04:21:26+0000]   Downloading charset_normalizer-2.1.1-py3-none-any.whl (39 kB)
8:21:26 PM appname: [04:21:26+0000] Collecting idna<4,>=2.5
8:21:26 PM appname: [04:21:26+0000]   Downloading idna-3.4-py3-none-any.whl (61 kB)
8:21:26 PM appname: [04:21:26+0000] Collecting certifi>=2017.4.17
8:21:26 PM appname: [04:21:26+0000]   Downloading certifi-2022.9.24-py3-none-any.whl (161 kB)
8:21:26 PM appname: [04:21:26+0000] Collecting urllib3<1.27,>=1.21.1
8:21:26 PM appname: [04:21:26+0000]   Downloading urllib3-1.26.13-py2.py3-none-any.whl (140 kB)
8:21:26 PM appname: [04:21:26+0000] Collecting pytz
8:21:26 PM appname: [04:21:26+0000]   Downloading pytz-2022.6-py2.py3-none-any.whl (498 kB)
8:21:27 PM appname: [04:21:27+0000] Collecting zope.interface
8:21:27 PM appname: [04:21:27+0000]   Downloading zope.interface-5.5.2-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (257 kB)
8:21:28 PM appname: [04:21:28+0000] Collecting aiohttp<4,>=3.7.4
8:21:28 PM appname: [04:21:28+0000]   Downloading aiohttp-3.8.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.0 MB)
8:21:29 PM appname: [04:21:29+0000] Collecting setuptools
8:21:29 PM appname: [04:21:29+0000]   Downloading setuptools-65.6.3-py3-none-any.whl (1.2 MB)
8:21:29 PM appname: [04:21:29+0000] Collecting aiosignal>=1.1.2
8:21:29 PM appname: [04:21:29+0000]   Downloading aiosignal-1.3.1-py3-none-any.whl (7.6 kB)
8:21:30 PM appname: [04:21:30+0000] Collecting multidict<7.0,>=4.5
8:21:30 PM appname: [04:21:30+0000]   Downloading multidict-6.0.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (114 kB)
8:21:31 PM appname: [04:21:31+0000] Collecting yarl<2.0,>=1.0
8:21:31 PM appname: [04:21:31+0000]   Downloading yarl-1.8.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (264 kB)
8:21:31 PM appname: [04:21:31+0000] Collecting frozenlist>=1.1.1
8:21:31 PM appname: [04:21:31+0000]   Downloading frozenlist-1.3.3-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (158 kB)
8:21:31 PM appname: [04:21:31+0000] Collecting attrs>=17.3.0
8:21:31 PM appname: [04:21:31+0000]   Downloading attrs-22.1.0-py2.py3-none-any.whl (58 kB)
8:21:31 PM appname: [04:21:31+0000] Collecting async-timeout<5.0,>=4.0.0a3
8:21:31 PM appname: [04:21:31+0000]   Downloading async_timeout-4.0.2-py3-none-any.whl (5.8 kB)
8:21:31 PM appname: [04:21:31+0000] Installing collected packages: azure-functions, charset-normalizer, frozenlist, aiosignal, multidict, idna, yarl, attrs, async-timeout, aiohttp, discord.py, discord, certifi, urllib3, requests, pytz, setuptools, zope.interface, datetime
8:21:34 PM appname: [04:21:34+0000] Successfully installed aiohttp-3.8.3 aiosignal-1.3.1 async-timeout-4.0.2 attrs-22.1.0 azure-functions-1.12.0 certifi-2022.9.24 charset-normalizer-2.1.1 datetime-4.7 discord-2.1.0 discord.py-2.1.0 frozenlist-1.3.3 idna-3.4 multidict-6.0.3 pytz-2022.6 requests-2.28.1 setuptools-65.6.3 urllib3-1.26.13 yarl-1.8.2 zope.interface-5.5.2
8:21:34 PM appname: WARNING: You are using pip version 20.2.3; however, version 22.3.1 is available.
8:21:34 PM appname: You should consider upgrading via the '/tmp/oryx/platforms/python/3.9.7/bin/python3.9 -m pip install --upgrade pip' command.
8:21:34 PM appname: Done in 10 sec(s).
8:21:34 PM appname: Preparing output...
8:21:34 PM appname: Copying files to destination directory '/home/site/wwwroot'...
8:21:35 PM appname: Done in 1 sec(s).
8:21:35 PM appname: Removing existing manifest file
8:21:35 PM appname: Creating a manifest file...
8:21:35 PM appname: Manifest file created.
8:21:35 PM appname: Done in 17 sec(s).
8:21:36 PM appname: Running post deployment command(s)...
8:21:36 PM appname: Generating summary of Oryx build
8:21:36 PM appname: Deployment Log file does not exist in /tmp/oryx-build.log
8:21:36 PM appname: The logfile at /tmp/oryx-build.log is empty. Unable to fetch the summary of build
8:21:36 PM appname: Triggering recycle (preview mode disabled).
8:21:36 PM appname: Linux Consumption plan has a 1.5 GB memory limit on a remote build container.
8:21:36 PM appname: To check our service limit, please visit https://docs.microsoft.com/en-us/azure/azure-functions/functions-scale#service-limits
8:21:36 PM appname: Writing the artifacts to a squashfs file
8:21:41 PM appname: Parallel mksquashfs: Using 1 processor
8:21:41 PM appname: Creating 4.0 filesystem on /home/site/artifacts/functionappartifact.squashfs, block size 131072.
8:21:43 PM appname: [=============================================================-] 2066/2066 100%
8:21:43 PM appname: Exportable Squashfs 4.0 filesystem, gzip compressed, data block size 131072
8:21:43 PM appname:     compressed data, compressed metadata, compressed fragments, compressed xattrs
8:21:43 PM appname:     duplicates are removed
8:21:43 PM appname: Filesystem size 7135.95 Kbytes (6.97 Mbytes)
8:21:43 PM appname:     28.88% of uncompressed filesystem size (24705.52 Kbytes)
8:21:43 PM appname: Inode table size 19443 bytes (18.99 Kbytes)
8:21:43 PM appname:     27.24% of uncompressed inode table size (71382 bytes)
8:21:43 PM appname: Directory table size 21266 bytes (20.77 Kbytes)
8:21:43 PM appname:     42.06% of uncompressed directory table size (50567 bytes)
8:21:43 PM appname: Number of duplicate files found 330
8:21:43 PM appname: Number of inodes 2221
8:21:43 PM appname: Number of files 2036
8:21:43 PM appname: Number of fragments 148
8:21:43 PM appname: Number of symbolic links  0
8:21:43 PM appname: Number of device nodes 0
8:21:43 PM appname: Number of fifo nodes 0
8:21:43 PM appname: Number of socket nodes 0
8:21:43 PM appname: Number of directories 185
8:21:43 PM appname: Number of ids (unique uids + gids) 1
8:21:43 PM appname: Number of uids 1
8:21:43 PM appname:     root (0)
8:21:43 PM appname: Number of gids 1
8:21:43 PM appname:     root (0)
8:21:43 PM appname: Creating placeholder blob for linux consumption function app...
8:21:43 PM appname: SCM_RUN_FROM_PACKAGE placeholder blob scm-latest-appname.zip located
8:21:43 PM appname: Uploading built content /home/site/artifacts/functionappartifact.squashfs for linux consumption function app...
8:21:43 PM appname: Resetting all workers for appname.azurewebsites.net
8:21:44 PM appname: Deployment successful. deployer = ms-azuretools-vscode deploymentPath = Functions App ZipDeploy. Extract zip. Remote build.
8:21:56 PM appname: Syncing triggers...
8:21:58 PM appname: Querying triggers...
8:21:59 PM appname: No HTTP triggers found.

I have authentication set to anonymous to start… I’m not sure what I need to configure.

Here is the default function I am trying to get to work:

    @app.function_name(name="HttpTrigger1")
    @app.route(route="hello", auth_level=func.AuthLevel.ANONYMOUS)
    def test_function(req: func.HttpRequest) -> func.HttpResponse:
         logging.info('Python HTTP trigger function processed a request.')

     name = req.params.get('name')
     if not name:
        try:
            req_body = req.get_json()
        except ValueError:
            pass
        else:
            name = req_body.get('name')

     if name:
        return func.HttpResponse(f"Hello, {name}. This HTTP triggered function executed successfully.")
     else:
        return func.HttpResponse(
             "This HTTP triggered function executed successfully. Pass a name in the query string or in the request body for a personalized response.",
             status_code=200
        )

And here is my host.json file:

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

2

Answers


  1. I have created Azure Functions Python Programming model v2 and while running locally, got some error which is:

    enter image description here

    Then I have Started the Azure Storage Emulator locally and the error is fixed.

    Running Locally:

    enter image description here

    Deploying to Azure:

    enter image description here
    enter image description here

    Note: After deploying to Azure, update the app settings which is newly added in local.settings.json for Python V2 model to the Azure by pressing F1 on VS Code > Add New Setting on Azure Functions > Add this key value pair – AzureWebJobsFeatureFlags: EnableWorkerIndexing.

    Refer this MS Doc for more information on running the functions in Azure with Python V2 model.

    Login or Signup to reply.
  2. Hari’s solution works just fine. However, it may be a little confusing why this is. A precise solution to the issue is described here in the VSCode tutorial to Azure Functions.

    In a nutshell, you want to add the following setting to your Azure Function Application Settings:

    AzureWebJobsFeatureFlags: EnableWorkerIndexing
    

    It’s the same entry that you probably also added to your local environment. It needs to be set up in Azure too. At least for now.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search