Self-Introduction
Hi there!
I'm Yoshihide Shiono, a freelance developer who absolutely loves TypeScript.
To be honest, I'm not exactly thrilled about upgrading from Serverless Framework v3 to v4. However, in this article, I'll explain why upgrading to v4 will eventually become a necessity for all of us.
What is the Serverless Framework?
The Serverless Framework is a Node.js-based tool designed to make developing and deploying serverless applications much easier.
It allows you to run code without having to worry about servers or clusters, so you can focus entirely on application development.
The Serverless Framework consists of an open-source CLI (the serverless command) and a web dashboard. By combining these, you can manage the complete lifecycle of your serverless applications.
With AWS Lambda, you can run code for virtually any type of application or backend service without needing any administration.
Differences between Serverless Framework v3 and v4
Official Blog: Serverless Framework V4 Generally Available
Licensing Changes
Up until v3, the Serverless Framework was free to use. However, starting with Serverless Framework v4, organizations with an annual revenue exceeding $2 million will need to purchase a paid subscription.
(Conversely, this means that if your annual revenue does not exceed $2 million, you can continue to use the Serverless Framework for free, just as before. It works similarly to Docker's model.)
Authentication required for every serverless command
Even if you don't purchase a paid subscription, authentication is required every time you run the serverless command. If you aren't authenticated, you'll be prompted to run serverless login.
This user information corresponds to an account on the web dashboard, so you'll need to register if you haven't already.
Alternatively, if an administrator already has access to the dashboard, you can use a license key issued from there to bypass the login prompt.
Focus on AWS Lambda support going forward
While previous versions supported Google Cloud, Azure, and others in addition to AWS, Serverless Framework v4 seems to be moving towards unifying development primarily around AWS.
Native TypeScript Support
serverless-esbuild, which was commonly used in v3, is no longer usable. Instead, TypeScript support is now built-in.
Currently, only esbuild is supported, but there's a possibility that other bundlers (like Webpack or Rollup) will be supported in the future.
Why we're gradually entering the era of Serverless Framework v4 (whether we like it or not)
Node.js v22 (LTS) doesn't run on Serverless Framework v3
Since Serverless Framework v4 introduces a paid model for some, there are many cases where teams would prefer to stick with v3 for as long as possible.
However, there is a shocking fact I want to shout from the rooftops:
As of March 2025, Node.js v22 does not work with Serverless Framework v3.
AWS Lambda itself announced support for Node.js v22 LTS in November 2024.
Since the EOL (End of Life) for Node.js v20 LTS is April 30, 2026, it is only a matter of time before we are forced to adopt a configuration of Serverless v4 + Node.js v22.
For this reason, at Enerbank Inc., we are also gradually proceeding with the introduction of Serverless Framework v4.
Ecosystem plugins are being absorbed into Serverless Framework v4
Not only is core development shifting to v4, but the ecosystem cultivated during the v3 era is expected to be gradually absorbed or phased out with the arrival of v4.
Let's consider the pattern of using esbuild as a TypeScript bundler.
serverless-esbuild was an external plugin in v3, but esbuild is built into the core functionality in v4. Consequently, including serverless-esbuild, serverless-webpack, or serverless-plugin-typescript will result in an error. (This is a breaking change.)
Example using esbuild in Serverless Framework v3
# serverless.yml
plugins:
- serverless-esbuild
custom:
esbuild:
minify: true
sourcemap: true
Example using esbuild in Serverless Framework v4
You can now describe esbuild settings using the build.esbuild option.
# serverless.yml
build:
esbuild:
bundle: true
minify: true
You can also specify a configuration file like esbuild.config.ts.
# serverless.yml
build:
esbuild:
configFile: esbuild.config.ts
// esbuild.config.ts
export default () => {
return {
minify: true,
sourcemap: true,
}
}
How to run Serverless Framework v4 in GitHub Actions
Running in GitHub Actions without serverless login
You will need an access key named SERVERLESS_ACCESS_KEY.
Generate an access key in the Serverless Framework dashboard and use it.
Since this is sensitive information, it's best to register it in GitHub Actions secrets and reference it from there.
By passing the GitHub Actions secret to the environment variable in serverless.yml, execution will proceed normally.
# serverless.yml
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Deploy App
run: serverless deploy
env:
SERVERLESS_ACCESS_KEY: ${{ secrets.SERVERLESS_ACCESS_KEY }}
If it works locally but not in GitHub Actions
You might need NODE_OPTIONS='--openssl-legacy-provider'.
When upgrading from Node.js v16 to v18, the OpenSSL major version was upgraded from v1 to v3. Depending on the libraries you use, you may need to enable the --openssl-legacy-provider option to maintain compatibility with the older OpenSSL.
Summary
- Starting with Serverless Framework v4, the licensing has changed; organizations with over $2 million in annual revenue must purchase a paid subscription.
- Since Serverless Framework v3 does not support Node.js v22 (LTS), upgrading to Serverless Framework v4 is necessary.
- Beyond core development, the plugin ecosystem is gradually being absorbed into Serverless Framework v4, which may force breaking changes in your project configuration.
Top comments (1)
"I'm not exactly thrilled about upgrading from Serverless Framework v3 to v4" - but, you don't have to - be aware that there's an alternative (see below) ...
Yeah they're pushing users to v4 because they have a "revenue model" with that version, it's in fact (semi)commercial now :-)
Also, they're dramatically expanding the scope with shiny new features (even though they're dropping Google/Azure support, which in my opinion wasn't ever to be taken serious anyway) - I think they're really try to exert some "vendor lock-in" on users :-)
However:
"I'll explain why upgrading to v4 will eventually become a necessity for all of us"
That's not a certainty - there is an "escape hatch":
v3 has been "forked", and there's a community-supported OSS version with pretty serious backing, and with the intention to develop and support/maintain it - here it is:
github.com/oss-serverless/serverless
and an article that I came across:
serverlesscorner.com/switching-to-...
In a nutshell:
drop-in replacement for Serverless Framework v3, maintained by community contributors
fully compatible with existing Serverless Framework v3 configurations, includes support for recent AWS Lambda runtimes (like Node.js 22 and Python 3.12)
Apart from that, I'm seeing evidence of quite a few people migrating away, to CDK or Terraform - the fact that Serverless is no longer "multi cloud" but AWS-only would only encourage that tendency ...
But, I think that the OSS version which I mentioned is a serious alternative - I would encourage users to "look before you leap", and to be aware there are alternatives - nobody's pushing you to migrate to v4.