-
Notifications
You must be signed in to change notification settings - Fork 481
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
Improve SQL User Lambda Delete operation #54464
Conversation
…before we attempt to delete a SQL User.
console.log(results.createUser); // Results from the CREATE USER query. | ||
console.log(results.updateUser); // Results from the UPDATE USER query. | ||
console.log(results.grantResults); // Array of results from each GRANT operation. | ||
// Results from the CREATE USER query. |
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.
nit: comments are no longer necessary with these logging messages.
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.
Fixed!
return await queryPromise(connection, dropUser); | ||
return await queryPromise(connection, dropUser).catch((error) => { | ||
if (error.code === "ENOTFOUND") { | ||
let databaseDeletedAlreadyMessage = ` |
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.
nit: prefer const
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.
Fixed!
Co-authored-by: Darin Webb <darin@code.org>
Deployed code-dot-org % bundle exec rake stack:lambda:start
Finished stack:lambda:environment (less than a minute)
PKG_CONFIG_PATH=/usr/X11/lib/pkgconfig yarn
PKG_CONFIG_PATH=/usr/X11/lib/pkgconfig yarn
PKG_CONFIG_PATH=/usr/X11/lib/pkgconfig yarn
PKG_CONFIG_PATH=/usr/X11/lib/pkgconfig yarn --production
PKG_CONFIG_PATH=/usr/X11/lib/pkgconfig yarn
PKG_CONFIG_PATH=/usr/X11/lib/pkgconfig yarn
PKG_CONFIG_PATH=/usr/X11/lib/pkgconfig npm install ci --only=prod
PKG_CONFIG_PATH=/usr/X11/lib/pkgconfig yarn
Pending update for stack `lambda`:
Modify SQLUserLambda [AWS::Lambda::Function] Properties (Code)
Proceed? [y/n]
y
Stack update requested, waiting for provisioning to complete...
.2023-10-25 05:49:19 UTC- SQLUserLambda [UPDATE_IN_PROGRESS]
..2023-10-25 05:49:26 UTC- SQLUserLambda [UPDATE_COMPLETE]
2023-10-25 05:49:28 UTC- lambda [UPDATE_COMPLETE_CLEANUP_IN_PROGRESS]
Stack update complete. |
During end-to-end testing of the SQL User lambda in #52796 we found that when a CloudFormation template incorrectly allows for a database resource to be deleted before a SQLUser resource, the delete operation fails on the SQLUser resource even though deleting the database effectively deletes the user.
Testing story
JS tests
CloudFormation validate
Deployment strategy
$ bundle exec rake stack:lambda:start
Follow-up work
Privacy
Security
Caching
PR Checklist: