Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't change default function name while using FastAPI #195

Open
ronaldo-omg opened this issue Dec 5, 2023 · 5 comments
Open

Can't change default function name while using FastAPI #195

ronaldo-omg opened this issue Dec 5, 2023 · 5 comments

Comments

@ronaldo-omg
Copy link

I've been trying to set a custom name while using FastAPI and couldn't find the proper way. It always deploys my function with the name "http_app_func," making deploying multiple functions to the same app impossible.

Has anyone been successful with this task?

This is the syntax I thought it would work:

app = func.AsgiFunctionApp(app=fastapi_app, http_auth_level=func.AuthLevel.FUNCTION).function_name(name="HttpTest")

@mortendaehli
Copy link

Hi! I think this issue is related to this:

Azure/azure-functions-docker#1033

In short, the AsgiFunctionApp does not have the mix-in from BindingApi and SettingsApi, and I think it's the latter that makes this fail.

Does anyone have a good explanation why these two are missing?

@sepira
Copy link

sepira commented Mar 6, 2024

Hi! @ronaldo-omg ! Were you able to find a workaround here?

@DCMattyG
Copy link

I'm interested in this as well. There's a similar discussion going on here:

Azure/azure-functions-python-worker#1284

@seidnerj
Copy link

seidnerj commented May 2, 2024

For the time being I commented out both calls to "self._add_http_app" under the AsgiFunctionApp and WsgiFunctionApp classes in function_app.py.

The amount of bugs I came across just trying to get started with Azure functions is unbelievable. This is the 6th or 7th bug I've encountered.

seidnerj added a commit to seidnerj/azure-functions-python-library that referenced this issue May 3, 2024
@himat-mesh-ai
Copy link

I think in previous versions of the azure-functions python package you could do it with the set_function_name method for each function in the app. That seems to have been deprecated now but this article outlines another way to do it using add_setting.

https://medium.com/mesh-ai-technology-and-engineering/how-to-host-fastapi-in-an-azure-function-and-thre-7f7bbb924344

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants