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: [#188558362] upgrade serverless to v4 #9241

Merged
merged 1 commit into from
Jan 13, 2025

Conversation

aadedejifearless
Copy link
Contributor

@aadedejifearless aadedejifearless commented Dec 6, 2024

Description

This PR upgrades the Navigator repository to Serverless Framework V4, addressing the end-of-life (EOL) and end-of-support status of V3. The upgrade ensures compatibility with the latest features, resolves deprecations and enhances security by aligning with updated best practices in V4.

Ticket

This pull request resolves #188558362.

Approach

The approach taken in this PR involved updating package dependencies to ensure compatibility with Serverless Framework v4, as the framework has reached its end of life and support for v3. Environment variable references were adjusted to include the SERVERLESS_ACCESS_KEY, which triggers the serverless login process, and a deployment bucket configuration was added for better stage-specific management. Additionally, the need for webpack has been eliminated since Serverless Framework v4 introduces native ESBuild support, simplifying the build process and reducing dependency complexity. This also enhances security and maintainability by removing outdated tools. The updates ensure that the project aligns with the latest Serverless Framework standards and best practices.

Steps to Test

  1. Push Changes to Test Branch: The changes were pushed to the test branch to ensure that the updates were applied to the appropriate environment.

  2. Validate Deployment: After pushing the changes, I validated the deployment by checking that the serverless-state.json file reflects the expected version 4 format, confirming that the migration to Serverless V4 was successful.

Notes

Code author checklist

  • I have rebased this branch from the latest main branch
  • I have performed a self-review of my code
  • I have created and/or updated relevant documentation on the engineering documentation website
  • I have not used any relative imports
  • I have pruned any instances of unused code
  • I have not added any markdown to labels, titles and button text in config
  • If I added/updated any values in userData (including profileData, formationData etc), then I added a new migration file
  • I have checked for and removed instances of unused config from CMS
  • If I added any new collections to the CMS config, then I updated the search tool and cmsCollections.ts (see CMS Additions in Engineering Reference/FAQ on the engineering documentation site)
  • I have updated relevant .env values in both .env-template and in Bitwarden

@aadedejifearless aadedejifearless force-pushed the serverless_v4_upgrade branch 24 times, most recently from 5fad1f1 to b6b74fd Compare January 9, 2025 15:16
.circleci/config.yml Show resolved Hide resolved
.circleci/config.yml Show resolved Hide resolved
@aadedejifearless aadedejifearless force-pushed the serverless_v4_upgrade branch 4 times, most recently from ad1a2c7 to d93ed7f Compare January 9, 2025 21:30
Copy link
Member

@seidior seidior left a comment

Choose a reason for hiding this comment

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

Super impressed you were able to implement this in such a short amount of time. Well done, Ade!

.circleci/config.yml Outdated Show resolved Hide resolved
.circleci/config.yml Outdated Show resolved Hide resolved
api/tsconfig.json Show resolved Hide resolved
@seidior
Copy link
Member

seidior commented Jan 10, 2025

Also, do we need to update our .env-template with a field for the Serverless Access Key?

package.json Show resolved Hide resolved
api/serverless.ts Outdated Show resolved Hide resolved
@aadedejifearless aadedejifearless force-pushed the serverless_v4_upgrade branch 2 times, most recently from 4faf1fa to aabe5a2 Compare January 10, 2025 16:54
@aadedejifearless
Copy link
Contributor Author

Also, do we need to update our .env-template with a field for the Serverless Access Key?

For this piece we only added the field for the the deployment key. since we no longer need to add the key to the .env file based on Case's comment.

.circleci/config.yml Outdated Show resolved Hide resolved
@@ -40,3 +40,4 @@ DYNAMICS_ELEVATOR_SAFETY_CLIENT_ID=
DYNAMICS_ELEVATOR_SAFETY_SECRET=
FEATURE_DYNAMICS_PUBLIC_MOVERS=
USE_WIREMOCK_FOR_FORMATION_AND_BUSINESS_SEARCH=
BIZNJ_SLS_DEPLOYMENT_BUCKET_NAME=
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we actually need this in our .env file? I think the answer is no, but if we need it then we should add this value to api/.env in Bitwarden.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yh updated that. We have a fall back as default-bucket which would avoid the

[@businessnjgovnavigator/api]: Packaging "businessnjgov-api" for stage "local" (*********)
[@businessnjgovnavigator/api]: 
[@businessnjgovnavigator/api]: ✖ Access denied when storing the parameter "/serverless-framework/deployment/s3-bucket". Please check your permissions and try again. You have the following op
at 'provider.deploymentBucket': must NOT have fewer than 3 characters``` error

@jphechter
Copy link
Contributor

2 brief comments

The only other thing I'd like to validate is that we've deployed this successfully to the testing site. If it's working there, then I'm very excited to see this go live.

@aadedejifearless
Copy link
Contributor Author

2 brief comments

The only other thing I'd like to validate is that we've deployed this successfully to the testing site. If it's working there, then I'm very excited to see this go live.

Yh this was also deployed to testing and there were no issue.

@aadedejifearless aadedejifearless merged commit fb68fc1 into main Jan 13, 2025
8 checks passed
@aadedejifearless aadedejifearless deleted the serverless_v4_upgrade branch January 13, 2025 15:47
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.

4 participants