a lambda function to fetch an HTML file uploaded to the Discord CDN and display it on the web - example
Start by running yarn to install all dependencies.
- Create a Serverless account -- note the username you provide, its the name of your
org. - Go to
orgon the side bar thenproviders. - Click
addthen create aSimpleprovider. Put in any name you'd like then clickConnect AWS provider. - You'll then be redirect to AWS. Click the acknowledgement at the bottom then
Create.
- Download the CLI app with your favorite package manager. I do
yarn global add serverless - Run
serverless login.
Edit the org field in serverless.yml to what org reads on the Serverless dashboard (this is the same value as your username, likely).
Run serverless deploy or ./deploy.sh to deploy the service. It may fail on the first attempt with the error Error: Application not found.. Just run serverless deploy again and it will deploy properly.
The output of serverless deploy outputs the execute endpoint URL. It will look similar to api-id.execute-api.region.amazonaws.com. All you have to do then is attach the uri query paramater which has the value of that Discord CDN-Uploaded HTML file.
Example:
https://foobar.execute-api.us-east-1.amazonaws.com/production?uri=https://cdn.discordapp.com/attachments/581635926757998613/866081381456805919/display-html-lambda.html