0
votes

I set up an Azure Functions app with Python in VS code. After creating a couple of http triggers, I wanted to create a Blobtrigger called xml-update. All worked well until I tried deploying it. The Functions app returns 404's. How can I debug this?

I have a Blob container in Azure Storage called xml-feed with a blob called jobs.json. When I deploy the Function App with these bindings (and boilerplate function code)...

{
  "scriptFile": "__init__.py",
  "bindings": [
    {
      "name": "myblob",
      "type": "blobTrigger",
      "direction": "in",
      "path": "xml-feed/jobs.json",
      "connection": "AzureWebJobsStorage"
    }
  ]
}

...the app exclusively returns 404's.

When I developed the BlobTrigger function locally, I was able to read and write without any problems. (To the actual cloud storage, not a local emulation.) The Function App logs show the folowing error:

resource name contains invalid characters

The following function.json restores the Function App's functionality, although this function is rendered useless.

{
  "scriptFile": "__init__.py",
  "bindings": [
    {
      "name": "myblob",
      "type": "blobTrigger",
      "direction": "in",
      "path": "",
      "connection": "AzureWebJobsStorage"
    }
  ]
}

If path is anything else than an empty string, the problem occurs. (Even if it is an ordinary string, which makes me suspicious of the invalid character error.) I haven't been able to dig up much more. I checked the connection string in Application Settings, fiddled with Storage permissions, but was unable to find the cause.

EDIT: Boilerplate function code:

import logging

import azure.functions as func

def main(myblob: func.InputStream):
    logging.info(f"Python blob trigger function processed blob \n"
                 f"Name: {myblob.name}\n"
                 f"Blob Size: {myblob.length} bytes")
1
The format is right. On my side, it is no problem. Can you show the code? And have you linked to the specific storage after deploy your function app to azure? - Bowman Zhu
Hi Bowman, I will add the boilerplate code to the question. What do you mean with “linking” the specific storage to a function? - mhschel
I mean set the specific storage connection string in the configuration settings. Because local.settings.json will not upload by deploy. - Bowman Zhu
@BowmanZhu Yes, I have a connection string from the storage account in the App settings. I wonder if there could be another reason that it won't connect to the storage. - mhschel
I want to mark sure, do you get this error without trigger this function? - Bowman Zhu

1 Answers

0
votes

I configured a brand new Function App and deployed the same code. Worked like a charm. I identified the difference between the two Function Apps: one was linked to a Custom Domain and the other was not. Removing the Custom Domain solves the issue. I will ask a separate question about this.