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

Documentation: Update .ConfigureFunctionsWorkerDefaults(...) to be .ConfigureFunctionsWebApplication(...) #648

Open
throwaway34059 opened this issue Mar 1, 2024 · 0 comments

Comments

@throwaway34059
Copy link

throwaway34059 commented Mar 1, 2024

In the documentation

It says to use:

namespace MyOpenApiFunctionApp
{
    public class Program
    {
        public static void Main()
        {
            var host = new HostBuilder()
            // Remove this line below
                .ConfigureFunctionsWorkerDefaults()
            // Remove this line above

            // Add these lines below
                .ConfigureFunctionsWorkerDefaults(worker => worker.UseNewtonsoftJson())
            // Add these lines above
                .Build();

            host.Run();
        }
    }
}

I guess newer versions of Azure Functions it should be:

.ConfigureFunctionsWebApplication(worker => worker.UseNewtonsoftJson())

This is mentioned in #629 but it's subtle and not the focus of that ticket. It took me a several tries and a couple hours to realize the documentation does not meet the scaffold of the function.

If you replace the line in the scaffold with documented version of things your get a 200 OK white screen.

@throwaway34059 throwaway34059 changed the title Documentation: Update .ConfigureFunctionsWorkerDefaults() to be ConfigureFunctionsWebApplication() Documentation: Update .ConfigureFunctionsWorkerDefaults(...) to be .ConfigureFunctionsWebApplication(...) Mar 1, 2024
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

1 participant