Creating an AWS Lambda App That Sends an SES Email Upon Successful Google Recaptcha in NodeJS v20
Node 16 was no longer going to be supported so I wanted to update my AWS Lambda app that validates Google Recaptcha via REST to the latest version (NodeJS v20). You may have to change some of the things around below, but it is working for me (proof is this websites Contact form; feel free to say Hello if this worked for you). I also posted the solution on StackOverflow:
You will want to add your own Recaptcha secret and also adjust the AWS Region. The event variables must also be customized based on the REST values sent via your AWS API Gateway (not covered here.) This took me awhile to wrap my horns around. I’m not a Node person by default so I had to learn many of the paradigms mentioned below like the HttpRequest syntax. The good thing about the following code is you don’t need to create any AWS Layers (zip files of packaged NodeJS files). The aws-sdk comes for free with Lambda.