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

feat(lambda): create lambda for migration of url(s) #1755

Merged
merged 3 commits into from
Dec 27, 2021

Conversation

wanlingt
Copy link
Contributor

@wanlingt wanlingt commented Dec 23, 2021

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:

  • The DATABASE_URL env var is provided directly in the lambda's environmental variables configuration, instead of GitHub secrets

Tests

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 to deploy stage for deployment of lambda functions.

Note: deploy-edu remains unchanged.

New environment variables:

  • SERVERLESS_STAGE : one of staging, production

New dependencies:

  • serverless-plugin-include-dependencies : This Serverless plugin makes deployed functions smaller by only adding the modules relevant to each handler

@wanlingt wanlingt force-pushed the feat/lambda/migrate-url-to-user branch 2 times, most recently from 71127ad to 1f95384 Compare December 23, 2021 03:44
@wanlingt wanlingt force-pushed the feat/lambda/migrate-url-to-user branch 14 times, most recently from 9bc8b17 to 421ef7b Compare December 27, 2021 03:42
@wanlingt wanlingt marked this pull request as ready for review December 27, 2021 06:05
@wanlingt wanlingt requested a review from LoneRifle December 27, 2021 06:05
@wanlingt wanlingt force-pushed the feat/lambda/migrate-url-to-user branch from 62ed152 to 8dabe66 Compare December 27, 2021 09:40
@wanlingt wanlingt force-pushed the feat/lambda/migrate-url-to-user branch from 8dabe66 to c3ecfef Compare December 27, 2021 09:57
@wanlingt wanlingt requested a review from LoneRifle December 27, 2021 10:11
Copy link
Contributor

@LoneRifle LoneRifle left a comment

Choose a reason for hiding this comment

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

Lgtm

@LoneRifle LoneRifle merged commit 99d53c8 into develop Dec 27, 2021
@LoneRifle LoneRifle deleted the feat/lambda/migrate-url-to-user branch December 27, 2021 12:20
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.

2 participants