Last active
April 23, 2021 15:34
-
-
Save taylorreece/70ed16b320da4fc398759dffa811620e to your computer and use it in GitHub Desktop.
Show that a Lambda reuses a "dirty" environment in subsequent requests.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The first time this lambda is invoked, you will see a console message, "Hello, world!" | |
// If you invoke the lambda again soon thereafter, you will see "Your message has been hijacked" | |
// due to console.log being overridden from the first invocation. | |
exports.handler = async (event) => { | |
console.log("Hello, world!"); | |
global.console.log = (msg) => { | |
console.error("Your message has been hijacked"); | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment