-
-
Notifications
You must be signed in to change notification settings - Fork 79
Add a v4 upgrade guide #277
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mnapoli
wants to merge
3
commits into
4.x
Choose a base branch
from
v4-upgrade-guide
base: 4.x
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,186 @@ | ||
| # Upgrading from osls v3 to v4 | ||
|
|
||
| osls v4 is a major release focused on internal upgrades and cleanup: | ||
|
|
||
| - **AWS SDK v3**: osls uses the AWS SDK under the hood to interact with AWS. osls v4 upgrades from the deprecated AWS SDK v2 to v3. | ||
| - **IAM Identity Center (AWS SSO) support**: Thanks to the upgrade to the AWS SDK v3, the `osls` CLI now supports AWS IAM Identity Center (aka SSO) credentials. | ||
|
|
||
| ## osls vs Serverless Framework | ||
|
|
||
| This guide is for upgrading the **`osls`** CLI (`npm install osls`), not [Serverless Framework](https://github.com/serverless/serverless). Both projects use "v3" and "v4" version numbers, but they are **different projects**. | ||
|
|
||
| **History (osls 3.x):** osls 3.x began as a fork of Serverless Framework v3. The repo was `oss-serverless/serverless` on GitHub and `osls` in npm. For clarity, the GitHub repo has been renamed to `oss-serverless/osls` to match. | ||
|
|
||
| **osls 4.x:** Continues the osls 3.x line with its own roadmap and improvements. It is unrelated to Serverless Framework v4. | ||
|
|
||
| If you are coming from Serverless Framework v3, you can upgrade to osls 4.x directly since osls 3.x was based on Serverless Framework v3. | ||
|
|
||
| ## Install osls 4.x | ||
|
|
||
| ```bash | ||
| npm install -g osls@4 | ||
| ``` | ||
|
|
||
| If you are migrating from Serverless Framework, you can either use the `osls` command explicitly or use osls as a stand-in for `serverless`: | ||
|
|
||
| ```bash | ||
| npm remove -g serverless | ||
| serverless --version | ||
| ``` | ||
|
|
||
| ### Removed CLI commands | ||
|
|
||
| These commands were deprecated (and broken) in 3.x and are removed in 4.x: | ||
|
|
||
| | Removed command | Replacement | | ||
| | --------------- | -------------------------------------------------- | | ||
| | `sls upgrade` | `npm install -g osls@4` (or the dist-tag you need) | | ||
| | `sls uninstall` | `npm uninstall -g osls` | | ||
|
|
||
| ## Breaking changes | ||
|
|
||
| ### Configuration validation defaults to `error` | ||
|
|
||
| In 4.x, invalid `serverless.yml` configuration **fails the command by default** (`configValidationMode: error`). In older 3.x setups that never set this property, invalid configuration often surfaced only as warnings. | ||
|
|
||
| If you need the previous behavior while migrating: | ||
|
|
||
| ```yaml | ||
| configValidationMode: warn | ||
| ``` | ||
|
|
||
| See [Configuration validation](./configuration-validation.md). | ||
|
|
||
| ### IAM settings must use `provider.iam` | ||
|
|
||
| Top-level provider IAM properties were deprecated in 3.x and are **removed** in 4.x. Move them under `provider.iam`: | ||
|
|
||
| | 3.x (removed) | 4.x | | ||
| | ---------------------------------- | --------------------------------------- | | ||
| | `provider.role` | `provider.iam.role` | | ||
| | `provider.rolePermissionsBoundary` | `provider.iam.role.permissionsBoundary` | | ||
| | `provider.iamRoleStatements` | `provider.iam.role.statements` | | ||
| | `provider.iamManagedPolicies` | `provider.iam.role.managedPolicies` | | ||
| | `provider.cfnRole` | `provider.iam.deploymentRole` | | ||
|
|
||
| `provider.iam.role.permissionsBoundary` is also accepted (CloudFormation naming). | ||
|
|
||
| See the [IAM guide](./iam.md). | ||
|
|
||
| ### Packaging: use `package.patterns` instead of `include` / `exclude` | ||
|
|
||
| `package.include` and `package.exclude` are no longer accepted. Use `package.patterns` instead. Prefix patterns with `!` to exclude. | ||
|
|
||
| **Before (3.x):** | ||
|
|
||
| ```yaml | ||
| package: | ||
| include: | ||
| - src/** | ||
| exclude: | ||
| - node_modules/** | ||
| ``` | ||
|
|
||
| **After (4.x):** | ||
|
|
||
| ```yaml | ||
| package: | ||
| patterns: | ||
| - src/** | ||
| - '!node_modules/**' | ||
| ``` | ||
|
|
||
| The same applies to function- and layer-level `package` blocks. See [Packaging](./packaging.md#patterns). | ||
|
|
||
| ### `variablesResolutionMode: 20210219` is rejected | ||
|
|
||
| The legacy variables resolver mode is no longer supported. Remove `variablesResolutionMode` from your configuration. | ||
|
|
||
| If you still have `variablesResolutionMode: 20210326`, it is accepted as a no-op in 4.x but deprecated, remove it when convenient. | ||
|
|
||
| See [Variables](./variables.md) and [Deprecations](./deprecations.md). | ||
|
|
||
| ### Serverless Console configuration is rejected | ||
|
|
||
| The `console` property in `serverless.yml` (legacy Serverless Dashboard configuration) is no longer accepted. You can safely remove it as `osls` is not compatible with Serverless Console or Dashboard. | ||
|
|
||
| ### `provider.lambdaHashingVersion` removed | ||
|
|
||
| The `provider.lambdaHashingVersion` property and the old `20200924` hashing algorithm are removed. osls 4.x always uses the current default hashing algorithm. | ||
|
|
||
| Remove `provider.lambdaHashingVersion` from your configuration. If you relied on the old algorithm, expect Lambda version identifiers to change on the next deployment (functions will be updated, not necessarily replaced). | ||
|
|
||
| ### EventBridge: native CloudFormation only | ||
|
|
||
| The legacy EventBridge custom-resource implementation and `provider.eventBridge.useCloudFormation` are removed. EventBridge events are always provisioned with native CloudFormation resources. | ||
|
|
||
| Remove `provider.eventBridge.useCloudFormation` from your configuration. | ||
|
|
||
| If you previously relied on the legacy custom-resource path, migrate by: | ||
|
|
||
| 1. Removing (or commenting out) EventBridge event definitions. | ||
| 2. Running `sls deploy` to remove the old resources. | ||
| 3. Restoring the EventBridge events and deploying again. | ||
|
|
||
| See [EventBridge](../events/event-bridge.md). | ||
|
|
||
| ### Alexa Skill events require an application ID | ||
|
|
||
| The bare `alexaSkill` event form without an `appId` is no longer supported. Use one of: | ||
|
|
||
| ```yaml | ||
| events: | ||
| - alexaSkill: amzn1.ask.skill.xx-xx-xx-xx | ||
| ``` | ||
|
|
||
| ```yaml | ||
| events: | ||
| - alexaSkill: | ||
| appId: amzn1.ask.skill.xx-xx-xx-xx | ||
| ``` | ||
|
|
||
| See [Alexa Skill](../events/alexa-skill.md). | ||
|
|
||
| ### Plugin custom variables: `configurationVariablesSources` only | ||
|
|
||
| Plugins that extend variable resolution via the old `variableResolvers` API will fail with `OLD_VARIABLE_RESOLVER_NOT_SUPPORTED`. Migrate to `configurationVariablesSources`. | ||
|
|
||
| See [Custom variables](./plugins/custom-variables.md). | ||
|
|
||
| ### Plugin CLI options must declare a `type` | ||
|
|
||
| Plugin command options must define `type` as `string`, `boolean`, or `multiple`. Options without a `type` cause `INVALID_CLI_OPTIONS_SCHEMA`. | ||
|
|
||
| See [Custom commands](./plugins/custom-commands.md#command-options). | ||
|
|
||
| ### AWS SDK v2 removed from osls | ||
|
|
||
| osls no longer bundles AWS SDK for JavaScript v2. All built-in AWS calls use **AWS SDK v3** (`@aws-sdk/client-*` packages). | ||
|
|
||
| For most users this is transparent. **Plugin authors** that imported `aws-sdk` from osls internals or assumed v2 behavior must migrate their plugins to AWS SDK v3. | ||
|
|
||
| ### Internal AWS client changes (plugin authors) | ||
|
|
||
| If your plugin uses osls AWS client helpers, verify behavior against 4.x: request/response shapes follow SDK v3 conventions (for example command input objects and async clients). | ||
|
|
||
| ## Still deprecated in 4.x (removed in 5.0.0) | ||
|
|
||
| These items still work in 4.x but emit deprecation warnings. Clean them up when you can: | ||
|
|
||
| | Item | Action | | ||
| | ------------------------------------ | ----------------------------------------------------------------------- | | ||
| | `projectDir` | Remove, ignored | | ||
| | `variablesResolutionMode: 20210326` | Remove, no-op | | ||
| | `provider.websocket.useProviderTags` | Remove, provider tags are applied by default | | ||
| | `provider.httpApi.useProviderTags` | Remove, provider tags are applied by default | | ||
| | Kinesis consumer naming | Set `provider.kinesis.consumerNamingMode: serviceSpecific` before 5.0.0 | | ||
|
|
||
| See [Deprecations](./deprecations.md). | ||
|
|
||
| ## Getting help | ||
|
|
||
| - [Deprecations](./deprecations.md) | ||
| - [Configuration validation](./configuration-validation.md) | ||
| - [GitHub issues](https://github.com/oss-serverless/osls/issues/new) | ||
|
|
||
| If something in this guide is unclear or missing, open a GitHub pull request, contributions are welcome. | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is something I'd like to revert. It will impact a lot of people for no gain. This was originally deprecated in serverless v2 and for v3 we walked back dropping these because how it was still used a lot. I think it's worth doing the same thing here.
(btw I'm opening this here but not related to this PR directly)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, sure. This will require two PRs. One to adjust v3 to say the removal is in v5 instead. One to re-add it to v4. I can handle that.