How to Add Puppeteer to an AWS Lambda Function
AWS isn't always straight forward. Here's a brief guide to adding a Lambda Layer with Puppeteer + Chromium to an AWS Lambda function execution environment
Cabeça de Queijo is a bi-lingual Brazilian Portuguese & English speaking fan club for the American National Football League (NFL) Team - Green Bay Packers across the entirety of Brazil. We are a group of fans that love the Packers and want to share our passion with other fans in Brazil.
Truth be told, I was looking for a way to connect with other NFL fans and to start to build/foster a community.
Before I get into it, you can view the public source code here + affiliated GitHub Actions to deploy.
It’s rather simple and follows my (new to me) standard system for deploying Astro websites to Amazon Web Services. The underlying stack is -
Simplicity was the name of the game here. The upcoming games section is rendered via a JSON blob that includes DateTime, opponent info, etc. The internationalization aspect took a bit of work since some was automated and some wasn’t (eg., certain pages would be overwritten and not have a Portuguese equivalent) - I believe this was an Astro Plugin that I leveraged to do the heavy lifting.
Initially, getting everything squared up on AWS took a bit longer than I anticipated. Previously for my personal website, I used a Gatsby site that we hosted in a single S3 Bucket in aws-east
that anyone could access on the public internet. However, I wanted to ensure that the site could be just as fast for people living in Brazil - so, I decided to setup CloudFront in front of the bucket. The request looks something like this:
HTTP Request -> Domain Name Server -> AWS CloudFront -> S3 Bucket -> Return Response to User
That being said, one problem I ran into came in the form of networking - there were miscellaneous errors with SSL Certificates & displaying content to the end user that took a bit of sleuthing.
The other area that took a bit of getting up to speed is using TailwindCSS - truth be told, it had been awhile since I was writing a bit of frontend code - so, I had to acclimate myself to their notion of Atomic CSS and how to utilize a DaisyUI theme with Tailwind.
My personal opinion is that the NFL will continue to grow in popularity in Brazil - much like the NBA has lately.
Even earlier this month it was reported that the NFL will host it’s first ever regular season game in the 2024 in São Paulo. Here’s to hoping the Packers come to Brazil!