feat(lambda): create lambda for migration of url(s) #1755
Merged
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.
Problem
Transfer of ownership is currently being done manually and directly in the prod database, which exposes us to unnecessary risks. Further details can be found in the Orphan Links Management Design Doc
Solution
Create an AWS lambda for both types of link transfer operations:
migrate_url_to_user
- to transfer a single link to a new email address (all lowercase)migrate_user_links
- to transfer all links belonging to an account to another account (all lowercase)The lambda handler executes the relevant SQL function, using the arguments provided in the
event
object.Details:
DATABASE_URL
env var is provided directly in the lambda's environmental variables configuration, instead of GitHub secretsTests
Invoke the test events in each lambda function by filling in the appropriate parameters, and check that the changes are reflected in the database
Deploy Notes
Add
serverless deploy
todeploy
stage for deployment of lambda functions.Note:
deploy-edu
remains unchanged.New environment variables:
SERVERLESS_STAGE
: one ofstaging
,production
New dependencies:
serverless-plugin-include-dependencies
: This Serverless plugin makes deployed functions smaller by only adding the modules relevant to each handler