Cloud Native 5 min read

Ensuring Consistent Serverless Deployments with Serverless Devs

This guide explains how Serverless Devs detects online changes to prevent deployment conflicts in Alibaba Cloud Function Compute, covering three scenarios—new resources, updates after online changes, and redeploying existing resources—while providing step‑by‑step experiments and a non‑interactive CI flag.

Alibaba Cloud Native
Alibaba Cloud Native
Alibaba Cloud Native
Ensuring Consistent Serverless Deployments with Serverless Devs

Background

When multiple developers work on the same Serverless project, updates made through different channels (e.g., console, CLI) can overwrite each other, leading to recurring bugs. Detecting whether a resource has changed online before a local deployment is essential to maintain consistency.

Online Change Detection in Serverless Devs

The Alibaba Cloud Function Compute component of Serverless Devs now supports online change awareness for three situations:

Creating a resource locally that does not exist online.

Deploying locally, then the resource is updated online, followed by another local deployment.

Creating a resource locally that already exists online.

Experiment Preparation

Use the s init command to create a function, selecting Alibaba Cloud Serverless and the HTTP Function - Python3 Example . The generated s.yaml defines the service ( fc-deploy-service) and the function ( http-trigger-function) in the cn-hangzhou region.

1. Deploy a New Resource Not Present Online

Since the resource does not exist online, run the deployment command. The process completes successfully, and the custom endpoint returns the expected response.

Update the function code locally and redeploy. The online service reflects the new code without any conflict.

2. Deploy, Then Update Online, Then Redeploy Locally

After an initial deployment, modify the function directly in the console and deploy the change. When redeploying from the local machine, Serverless Devs detects the online modification and prompts for confirmation. Choosing “yes” overwrites the online version, and the final state matches the local code.

The detection works for any change to services, functions, or triggers, whether it is configuration or code.

3. Deploy a Resource That Already Exists Online

Delete the local project, recreate it, and attempt deployment. Because the resources already exist online, Serverless Devs warns about the potential overwrite and asks for confirmation before proceeding.

Conclusion

Detecting online changes is crucial for safe code releases in Serverless environments. Serverless Devs provides this capability, and the --ues-local flag enables non‑interactive, CI‑friendly deployments by forcing local configurations to override online ones.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Cloud NativeServerlessci/cdAlibaba CloudDeployment Consistency
Alibaba Cloud Native
Written by

Alibaba Cloud Native

We publish cloud-native tech news, curate in-depth content, host regular events and live streams, and share Alibaba product and user case studies. Join us to explore and share the cloud-native insights you need.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.