Migrate from Serverless v2 to v3
Based on Midway's upgrade to v3, the Serverless system has also been upgraded to v3 version simultaneously.
This article describes how to migrate from Serverless v2.0 to Serverless v3.0, which is very similar to traditional application upgrades.
We are still adjusting the v3 version of the function, mainly for the entry part and test part generated by the deployment, and the user code should not change.
Manual upgrade
Midway v3 can start from node V12. Therefore, the container environment for related functions must be the version of Node. js V12 or later.
1. Upgrade of Project Package Version
Dependent package upgrade, related package upgrade to 3.0.
{
"dependencies": {
"@midwayjs/core": "^3.0.0",
"@midwayjs/decorator": "^3.0.0",
"@midwayjs/faas": "^3.0.0"
},
"devDependencies": {
"@midwayjs/cli": "^1.2.45 ",
"@midwayjs/mock": "^3.0.0",
"@midwayjs/serverless-app": "^3.0.0",
// ...
}
}
2. Changes in the main frame of the entrance
For example, provide faas as the main framework.
// src/configuration
import * as faas from '@midwayjs/faas';
@Configuration({
// ...
imports: [
faas
],
})
export class MainConfiguration {
// ...
}
Due to the adjustment, the current modification may not be complete, and users with concerns should not use V3 functions for the time being.