Upgrade Azure durable functions from 1.6.2 to 1.7.0 Nodejs - azure

I have written some durable functions using version 1.6.2 . The new 1.7.0 is now out. I want to upgrade.
Will just doing
func extensions install -p Microsoft.Azure.WebJobs.Extensions.DurableTask -v 1.7.0 do the job? or do I need to do something else?

We don't need to do anything else except upgrading the extension. 1.7.0 release doesn't change existing APIs but adds new features and fixes bugs, so our code depending on 1.6.2 extension will not break.
As for the new features, some of them are related to DurableOrchestrationClient which is not implemented in current JS SDK, so we can't benefit from them unless SDK is upgraded. We can try others like call built-in HTTP API for starting new orchestration, e.g locally call http://localhost:7071/runtime/webhooks/durabletask/orchestrators/{functionName} to strat new orchestrator instead of using Http trigger as a starter.
About Durable Functions commands in Azure Functions Core Tools, the new release of Cli has not been pushed to npm so we can't update it as well.

Related

How to check minor Node.js version in AWS Lambda and Elasticbeanstalk?

I'm relying on Node version 12.17.x to make use of a specific feature (AsyncLocalStorage) in Lambda and Elasticbeanstalk. But for some reason, the Node.js version does not seem to publicly available. Why do they think that platform "12.x" tells me the real Node version? I want to know the exact minor and patch version, or at least give some news about it...
I had to create a test lambda function that prints process.version, but surprisingly, platform 12.x still uses v12.16. When will they upgrade to the latest stable version that came out more than 2 weeks ago? Are they publishing those releases somewhere? Google tells me nothing useful.
The same applies to Elasticbeanstalk instances. Node v12.17 does not exist in /opt/elasticbeanstalk/node-install/*
I've just checked in our sentry and the current version is newer-v12.18.4 so you can safely use AsyncLocalStorage now on v12 lambdas.
But AWS should really show this in the lambda administration panel. The fact that this is not shown anywhere and we have to use console logs or third party tools to get this info is a very poor DX.

Is it recommended to upgrade a deployed v2 azure function to v3 or is it better to create new resources and deploy to them from scratch?

We have a function deployed to azure running the v2 runtime. If I go to the function in the portal to try to upgrade it to v3, I see this message "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."
However, I was able to change the function in Visual Studio and deploy, using a simple test deploy of right-click publish, and the publishing process upgraded the deployed function to runtime v3.
Are there any gotchas we may run into using this approach? Is it better practice to create new azure function resources to deploy to a clean v3 azure function?
Thanks
Apparently no one else has this question or the answer is obvious. In any case, here's Microsoft's recommendation from their support personnel (grammar/language translation is Microsoft's):
Based on the official documentation changing the version can be made by changing the App Setting "FUNCTIONS_EXTENSION_VERSION" value form ~2 to ~3 however this can cause some problems if there are any dependencies unique to version 2 of the runtime, you can read more about this in the following link
https://learn.microsoft.com/en-us/azure/azure-functions/functions-versions#migrating-from-2x-to-3x
Now based on my experience the safest an easiest way to archive [achieve] this is to deploy the code into a Function app that was created targeting the version 3 of the runtime this is to assure [ensure] that it will only have the dependencies form [from] version 3 and not having anything extra from 2 left after changing the version directly from the portal
The idea with this is to avoid having conflicts from between assets form version 2 or missing assets from version 3
Suppose you are using c# function, if yes, the major update about v2 to v3 is the .net core version. So mostly if your code could work with the update that means your dependencies are compatible with .net core3, so mostly it won't crash.
And there is an official doc about migrating from 2.x to 3.x.
And about deploying, if the runtime is different when you deploy it will prompt to update the portal runtime, so it won't affect the function running.

Node global npm package, keeping up to date

I have published a global node package via npm to generate boilerplate templates for projects at my company.
I would like to compare the current version with the latest published in order to exit the process if it’s not the latest.
What node libraries would you recommend to check for the latest version.
Is there a way to auto update the global package if a new version is detected.
Remember this is an internal tool for my company so It’s critical they are creating projects with the latest templates and I’d like them to be able to update as automatically or easily as possible
Personal Suggestion
Instead of forcing the user to upgrade, another option is to publish your templates (as zip) on remote static server (e.g. S3). In such case, you can often update the zip to the latest template without upgrading the template generator.
generate-template angularjs-template:latest
generate-template angularjs-template:4.3
Answering Your Questions
What node libraries would you recommend to check for the latest version.
I am not sure if there is a library for this. However, you can build one very easily.
Create a JSON file which contains the package information (e.g. latest stable version, deprecation message, etc.).
Upload the JSON file to a remote static server.
Whenever the user runs your program, download the JSON file and check against the current package.json.
Show a deprecation warning if the user should upgrade.
process.exit() the application if the user must upgrade.
Is there a way to auto update the global package if a new version is detected.
I think it is better to leave the control to the user, because there could be some reasons why he doesn't prefer upgrade. For example, if the user has a bunch of projects started 10 months ago, he might want to use the same template for newer projects.
But if you really want to automate it, you might use the following code (not tested).
const { execSync } = require('child_process');
const pkg = require('./package.json')
execSync(`npm update -g ${pkg.name}`)
process.exit()

.Netcore alternative for Microsoft.Azure.Management.HDInsight.Job?

I'm working on converting a library from full .NetFramework to .NetCore
I'm looking for a replacement for Microsoft.Azure.Management.HDInsight.Job, which hasn't been updated in over a year and is not compatible with .NetCore. I was hoping that the functionality would be rolled up into the much-more-recently-updated and netcore-compatible Microsoft.Azure.Management.HDInsight, but that doesn't appear to be the case.
I'm down to use the REST API, but I haven't been able to find the same functionality there. Any guidance would be appreciated.
You could try to install Microsoft.Azure.Management.HDInsight.Job with Package Manager to install some prerelease versions, so that its dependencies would not be conflict with your asp.net core.
I test them, no matter it is preview, it also have the functionality what you want.
Write in Package Manager Console such as:
Install-Package Microsoft.Azure.Management.HDInsight.Job -Version 1.0.7-preview
You could only install the version <= 1.0.7-preview. If not, you may could not install it.
For more detail, you could refer to this article.
I found the REST API I was looking for. It is the WebHCat API, not an Azure API.
MapReduce Job creation: https://cwiki.apache.org/confluence/display/Hive/WebHCat+Reference+MapReduceJar
Pig Job creation:
https://cwiki.apache.org/confluence/display/Hive/WebHCat+Reference+Pig
Hive Job creation:
https://cwiki.apache.org/confluence/display/Hive/WebHCat+Reference+Hive
Sqoop Job creation: https://learn.microsoft.com/en-us/azure/hdinsight/hadoop/apache-hadoop-use-sqoop-curl and https://sqoop.apache.org/docs/1.99.3/RESTAPI.html
Hopefully they will release 3.0.0 soon
https://github.com/Azure/azure-sdk-for-net/issues/9219

Azure Functions and Node.js

Let's say I have a Node.js app I want to build with a TimerTrigger on Azure Functions.
What would be the best way to develop it? I already tried setting the NODE_DEFAULT_VERSION to 8.7.0 but it's still giving me problems like incorrect syntax when I know the Node can handle it.
Does anyone have any experience building Node.js apps on Azure?
In the current version of the function runtime, you cannot choose the Node version. But in the next version, which is currently in Preview, you can and will be able to pick 8.7.0. See https://learn.microsoft.com/en-us/azure/azure-functions/functions-versions for details.

Resources