-
Notifications
You must be signed in to change notification settings - Fork 478
Closed
Description
I have a very weird issue and it only happens when I add the load_dotenv() line.
Environment:
Azure function locally with Fast API
References:
- Create an Azure Function locally
https://learn.microsoft.com/en-us/azure/azure-functions/functions-develop-vs-code?tabs=nodejs#debugging-functions-locally - Setup FAST API with Azure Functions
https://github.com/Azure-Samples/fastapi-on-azure-functions/tree/main
Code:
[import logging
import azure.functions as func
import os
import openai
from FastAPIApp import app # Main API application
from dotenv import load_dotenv
load_dotenv()
@app.get("/sample")
async def index():
return {
"info": "Try /hello/Shivani for parameterized route.",
}
@app.get("/hello/{name}")
async def get_name(name: str):
return {
"name": name,
}
async def main(req: func.HttpRequest, context: func.Context) -> func.](url)HttpResponse:
return await func.AsgiMiddleware(app).handle_async(req, context)
Without load_dotenv() the code works perfect, any idea?
joansegura
Metadata
Metadata
Assignees
Labels
No labels