azure-functions-python-worker: [BUG] Azure function works locally but not when deployed
Investigative information
Please provide the following:
- Timestamp: 2023-07-20T14:31:57Z
- Function App name: xxxx
- Function name(s) (as appropriate):
- Core Tools version:C
- Core Tools Version: 4.0.5198 Commit hash: N/A (64-bit) Function Runtime Version: 4.21.1.20667
Repro steps
Provide the steps required to reproduce the problem:
I developed an Azure Function iN VS code and it works locally, I can test it in Postman or in the browser.
Just a small example of one of the functions:
@app.route(route="CreatePineConeIndex")
def CreatePineConeIndex(req: func.HttpRequest) -> func.HttpResponse:
"""Create a Pinecone index.
Args:
req (func.HttpRequest): The HTTP request object.
Returns:
func.HttpResponse: The HTTP response object.
"""
try:
req_body = req.get_json()
api_key = req_body.get('api_key')
environment = req_body.get('environment')
index_name = req_body.get('indexName')
dimensions = req_body.get('dimensions', 1536)
metric = req_body.get('metric', 'dotproduct')
client = PineconeClient(api_key=api_key, environment=environment)
client.CreateIndex(index_name, dimension=dimensions, metric=metric)
return func.HttpResponse("Index Created", status_code=200)
except Exception as e:
return func.HttpResponse(f"Could not create Pinecone Index. {str(e)}", status_code=500)
I have tested the deploy from VS Code or via Azure Devops pipelines, deployment works without any errors
However the Azure Function url /api/CreatePineConeIndex shows as 404 however localhost/api/CreatePineConeIndex works
I already did this: https://learn.microsoft.com/en-us/azure/azure-functions/recover-python-functions?tabs=vscode%2Cbash&pivots=python-mode-decorators#issue-with-deployment
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 23 (2 by maintainers)
I added some logging and couldnt find any exception, however in the traces I can see:
No job functions found. Try making your job classes and methods public.
I had to set the log level to debug in the host.json
and then in the application insights a simple
pls share your requirement .txt file
seems issue in pine core client lib will update you on this as soon as possible. Thanks