CLOUD FUNCTION RUNTIME REVAMP: A GUIDE TO STAYING AHEAD OF THE CURVE

Cloud function is a serverless execution environment for building and connecting cloud services. These functions are bite-sized pieces of code designed to perform specific tasks, triggered by cloud events like a button press or a new file upload.


RUNTIME SUPPORT

Cloud Functions rely on runtimes. These are essentially software environments that provide the necessary libraries and configurations for your code to function in its chosen language (Node.js, Python, Java in our example). Runtime support is the compatibility and maintenance of these environments by the cloud service provider and in this case Google.

THE RECENT ADVISORY

The recent advisory on cloud functions is essentially an announcement from Google about changes to the supported programming languages and versions for running cloud functions. 

This includes updates to language runtimes, deprecation of older versions, or even addition of the new languages. 

The advisory is very important however, Changes to runtime support could affect the performance, stability, and security of your code. It’s essential to stay informed about these updates to ensure your applications continue to run smoothly. 

In the most recent advisory, Google highlighted the following runtime versions as outdated ones, they are no longer supported and maintained by their language communities and are vulnerable to bugs and security issues.

  • Node.js 8, 12, 14, 16
  • Python 3.7, 3.8
  • Go 1.11, 1.12, 1.13, 1.16, 1.18, 1.19
  • Ruby 2.6, 2.7, 3.0
  • PHP 7.4, 8.1
  • .NET 3

To get more information about the runtime support lifecycle, regularly review and monitor the lifecycle policy and support schedule for the runtime language in Google Cloud functions https://cloud.google.com/functions/docs/runtime-support#support_schedule%5C

HOW TO UPDATE/ TRANSITION TO NEW RUNTIME VERSIONS

The following are steps that should be followed when updating the runtime versions;

  1. Log into the Google Cloud console and select the project that you want to update 

Project to be updated

2. Navigate to Cloud Functions: In the console select ‘ Cloud Function ‘ from the menu on the left-handside or use the search bar top-left to search and navigate to cloud functions with ease.

3. Select the specific function you want to update the runtime version.

                    The function with a deprecated runtime version

4. Access the function settings: click the function it will take you to the function’s details page. 

      Function settings   

5. On the details page, locate the section that contains the runtime settings, click on source and click edit. In the runtime settings sections, you should see an option to change the runtime version. Click on this option and select the desired runtime version from the available option(should be the latest version)

       Updating the  deprecated runtime version

6. After selecting the new runtime version, make sure to save the changes by clicking the ‘SAVE AND DEPLOY’ button on the function detail page.

save and deploy the function

7. Test function: it is essential to test the function after making changes to ensure that it still behaves as expected with the updated runtime version.

Note: Do not test the function if the project VM instances are actively running “in use” it will shut down the VM based on the user case of our function

Testing the updated runtime version

8. Monitor functions performance and logs after the update to ensure that everything is running smoothly.

If you encounter any issues or performance problems after updating the runtime version, you may need to restore the previous version within your  Google Console it allows you to restore changes to function and refactor your code.