3

Create a new Azure Function App from the Azure Portal. Add a new function to it. You will be presented with a warning icon with the following text:

Cannot Upgrade with Existing Functions

Major version upgrades can introduce breaking changes to languages and bindings. When upgrading major versions of the runtime, consider creating a new function app and migrate your functions to this new app.

My question is what action is required? Is it simply a warning that a future upgrade might cause issues? Perhaps is it related to the GitHub commentary about new template versions in Visual Studio

Note: deleting the all functions from the function app, causes the issue to disappear.

Andy Palmer
  • 75
  • 1
  • 7

2 Answers2

5

You are right, it's just a tip for you to refer, no action required.

When you create a function app in portal, the app uses the runtime ~1 by default.

Before you create any function in the app, you are allowed to change the runtime version in the function app settings panel.

After that, it's not recommended and also not allowed to change as the button is grey in this panel, with the warning you see. Because the runtime upgrade may cause error to your code depending on the specific runtime.

And as you see, once no function exists in the app, the warning disappears and is able to change the runtime again.

The application settings panel allows us to change FUNCTIONS_EXTENSION_VERSION (i.e. the runtime)between ~1 and beta despite existing functions, but still remember the runtime switch may cause breaking changes.

Update

Preview beta runtime has been GA and corresponding FUNCTIONS_EXTENSION_VERSION is changed to ~2, when we create a function app, default runtime is changed to ~2 as well.

Jerry Liu
  • 17,282
  • 4
  • 40
  • 61
  • It's extremely unclear how to come off the Prerelease version - I've tried several times. If I leave it as ~1, my next function then has the whole prompt thing. Not intuitive - I'm under the impression this isn't meant to be prerelease any more? – Richard Griffiths Apr 30 '18 at 10:12
  • @RichardGriffiths, the ~1 version is not compatible with prerelease version(beta) , former is based on.net framework and latter is based on .net core. The prompt is meant to remind us ,if you have created functions depending on one runtime, you'd better not change your runtime to another version. Runtime version should be decided when no function is created in the app, in case the change of runtime causes breaking changes to your code. – Jerry Liu Apr 30 '18 at 14:24
  • What is confusing is the message remains regardless of which version you set. I'm sticking with ~1 as accessing Configuration and some other libraries seems to work properly. Thank you :). – Richard Griffiths Apr 30 '18 at 15:10
  • @RichardGriffiths Yeah, one tip is used for two scenario. The tip should be `major version downgrades can introduce breaking changes` if current version is beta. Or we can simply say `version change` instead of up/downgrade. ~1 is GA and works well with .net framework libs, just enjoy it. – Jerry Liu Apr 30 '18 at 15:27
4

The warning is there so you wouldn't go and possibly break your current v1 functions when upgrading the runtime to v2.

Consider for example the following code examples:

V2 template:

[FunctionName('Function1')]
        public static IActionResult Run([HttpTrigger(AuthorizationLevel.Function, 'get', 'post', Route = null)]HttpRequest req, TraceWriter log)
        {

V1 template:

[FunctionName('Function1')]
        public static async Task<HttpResponseMessage> Run(
            [HttpTrigger(AuthorizationLevel.Function, 'post', Route = null)]
            HttpRequestMessage req,
            TraceWriter log)

These two function definitions use different versions of the runtime.

If you'd, at the press of a button, go and update the runtime, then you'd break your code. Hence the suggestion, create a new function app entirely using the new version and migrate your code to it instead of just updating the runtime.

Code snippet I found here.

kim
  • 3,385
  • 2
  • 15
  • 21