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

[WebToolsE2E] Publish Azure Function app under Aspire orchestration, the publish succeeds but the ACA fails to load successfully #6297

Closed
balachir opened this issue Oct 14, 2024 · 9 comments
Assignees
Labels
area-integrations Issues pertaining to Aspire Integrations packages azure Issues associated specifically with scenarios tied to using Azure azure-functions Issues related to the Azure Functions integration
Milestone

Comments

@balachir
Copy link

INSTALL STEPS

  1. Clean machine: Win11 x64 23h2 ENU
  2. Install VS 17.12 Preview 3, latest build
    • includes .NET SDK 9.0 rc2
    • includes Aspire 8.2.0 workload
  3. Install Aspire.ProjectTemplates - latest version 9.0.0-rc.1.24511.1
    • Add dotnet8 feed
    • dotnet new install Aspire.ProjectTemplates::9.0.0-rc.1.24511.1 --force
    • Templates get installed fine
  4. Install azd (latest daily build),
    • Installed version 1.11.0-beta.1-daily.4210036

REPRO STEPS

  1. New Project > Azure Functions app > .NET 8.0 Isolated > Http Trigger > Anonymous authentication > FunctionApp_net80_15

    • Also choose to 'Enlist in Aspire'
  2. Run the app locally (Ctrl+F5 using VS) - works fine

  3. Open command-line, run azd init and azd up - publish completes successfully

  4. Click on the ACA endpoint in the publish output to open it

ACTUAL
ACA page shows that the container app is stopped or does not exist.

Image

Container app shows activation failed in the Azure portal

Image

EXPECTED
ACA to be available and running after publish

@balachir balachir added the azure-functions Issues related to the Azure Functions integration label Oct 14, 2024
@balachir balachir added this to the 9.0 milestone Oct 14, 2024
@captainsafia
Copy link
Member

@balachir I believe that you may be running into this issue because the Functions templates are not yet updated to use the latest versions of their packages which provide container support. I've added a note about this in the instructions but here it is for posterities sake.

Before moving forward with this scenario, verify that the project file for your Functions project is using at least version 2.0.0-preview2 of the Microsoft.Azure.Functions.Worker.Sdk and 2.0.0-preview1 version of the Microsoft.Azure.Functions.Workerpackage.

Can you confirm the versions referenced in the project you deployed and see if updating to the above resolves the issue?

@davidfowl davidfowl added area-integrations Issues pertaining to Aspire Integrations packages azure Issues associated specifically with scenarios tied to using Azure labels Oct 15, 2024
@KennethHoff
Copy link

I tried out the azd integration for the first time today, and with lastest Aspire 8.* as well as the latest preview here (https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet8/nuget/v3/index.json) I experience the same Error 404 - This Container App is stopped or does not exist. error.

This is with something as simple as:

// AppHost Program.cs
var builder = DistributedApplication.CreateBuilder(args);

builder.AddProject<Projects.WebApi>("web-api");

builder.Build().Run();

// WebApi Program.cs
var builder = WebApplication.CreateSlimBuilder(args);

var app = builder.Build();

app.MapGet("/", () => TypedResults.Ok("Hallo"));

app.Run();

@captainsafia
Copy link
Member

@KennethHoff It looks like you're running into an issue with a Minimal API project. I'd recommend filing a new issue for that. This bug relates to deployment for Azure Functions.

@KennethHoff
Copy link

(I figured out my problem btw; It was because I seemingly needed .WithExternalHttpEndpoints() on my web-api resource. I couldn't find that in any of the quick start documentations for azd w/ Aspire however..)

@captainsafia
Copy link
Member

@balachir Does this issue still repro with the latest versions of Visual Studio and Aspire? The Functions templates should be updated to use the correct versions in Visual Studio now.

@joperezr
Copy link
Member

Hey @balachir, have you had a chance to test this one again? It would be good to validate that this is fixed.

@v-elenafeng
Copy link

This doesn’t look like a real issue or specific to functions app, we need to add the code .WithExternalHttpEndpoints() to expose the app. And by default only the frontend web app in the aspire-starter template is exposed.

@captainsafia
Copy link
Member

@v-elenafeng The WithExternalHttpEndpoints is definitely part of the problem. However, based on the fact that the container itself appears to be in a bad state there is probably an issue with deployment in the bits used as well.

Image

@balachir
Copy link
Author

@captainsafia @v-elenafeng I tried this again today and I'm able to get this to work now for Functions (.NET 8 Isolated) template. Two changes are needed to get the deployment to ACA to work successfully.

  • Add WithExternalHttpEndpoints
    • Image
  • Update the Functions.Worker packages in Functions app to latest 2.0.0 versions.
    • Image

After I do this, I can get the Functions app and dashboard showing in Azure.

Image

Image

I'll go ahead and close this issue. We can open a new one if there are additional problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-integrations Issues pertaining to Aspire Integrations packages azure Issues associated specifically with scenarios tied to using Azure azure-functions Issues related to the Azure Functions integration
Projects
None yet
Development

No branches or pull requests

6 participants