Skip to content
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

Chore/serverless upgrade #1900

Merged
merged 6 commits into from
Aug 18, 2022
Merged

Chore/serverless upgrade #1900

merged 6 commits into from
Aug 18, 2022

Conversation

gweiying
Copy link
Contributor

@gweiying gweiying commented Aug 2, 2022

Problem

Version 3 of the Serverless framework is out. We fix some breaking changes and upgrade our Serverless framework to v3 in this PR.

Closes #1883

Solution

Changes:

stage
Previously we injected SERVERLESS_STAGE (takes values staging or production) into serverless.yml as an env variable to reuse the serverless.yml template for launching both our staging and production lambdas. However, Serverless v3 requires stage to be resolved before as it is used to load and resolve .env files e.g. .env.development, .env.production. As advised by the team, we switch to setting this via the CLI flag --stage.

useDotEnv: true
Explicitly enabled to read environment variables, as loading .env files is kept opt-in

configValidationMode: error
Explicitly throw errors so that any misconfiguration on the file will throw an error before deployment. Severless has future plans to make this the default mode, so swapping over early can't hurt

--verbose
CLI flag -v option is no longer recognized](https://www.serverless.com/framework/docs/guides/upgrading-v3#cli-commands-and-options), swapped to --verbose

Tests

  • Test Lambda functions on staging to see if new Lambda functions still work

Deploy Notes

Post deployment, to test lambda functions in production to see if new Lambda functions are working. Also ensure that configurations are not removed (VPC and env variable settings).

@gweiying gweiying force-pushed the chore/serverless-upgrade branch from 48c124f to c9adda2 Compare August 2, 2022 10:34
yong-jie
yong-jie previously approved these changes Aug 2, 2022
Copy link
Member

@yong-jie yong-jie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, thanks a bunch for the work!

Noted on the removal of SERVERLESS_STAGE in favor of --stage in the declaration file. However, I also noticed the env var being renamed to BRANCH_ENV. Was it done to make it generic-sounding and more reusable for like the docker app (beyond just the serverless lambdas)?

Just some added documentation for future readers of this PR: Another small improvement introduced by this PR is the exclusion of devDependencies, directly reducing our packaged lambda size. Given that this PR has been tested on staging, we know that this change works fine.

@yong-jie
Copy link
Member

yong-jie commented Aug 2, 2022

also i just realised that the renaming of SERVERLESS_BRANCH could have some merge conflicts with dat's #1896 , where he injected SERVERLESS_BRANCH into the docker build command for datadog stuff. i'll try to help him integrate these changes into his PR after this one is merged.

@yong-jie yong-jie dismissed their stale review August 4, 2022 06:55

the merging of dat's PR breaks some env var changes that this PR will introduce

@gweiying gweiying requested a review from yong-jie August 18, 2022 09:00
Copy link
Member

@yong-jie yong-jie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@yong-jie yong-jie merged commit 161242e into develop Aug 18, 2022
@yong-jie yong-jie deleted the chore/serverless-upgrade branch August 18, 2022 18:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Upgrade to Serverless Framework v3
2 participants