You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Payton Garland edited this page Mar 16, 2018
·
5 revisions
cloudfront-auth provides users with an easy way to debug and test their lambda function before CloudFront deployment. With the debugger, the entirety of the authentication/authorization process is ran in one sweep and all data is outputted to a log. The debugger will simulate CloudFront requests and users are redirected to a local server with ngrok.
How it works
Tests are done by manually invoking the Lambda function without going through CloudFront. Upon manual invocation, a simulated CloudFront payload is used exactly as it would be in production. The responses are then stored in a log for further analysis. To avoid using the production endpoint for CloudFront, we setup a local server and use ngrok to get a temporary endpoint. As a result, tests can be executed without risking the security of content distributed by CloudFront.
To begin tests, create a test configuration file placed in your distribution folder (see below). Next, go to the root directory and run npm test -- distribution where distribution is the distribution you named in build. Once finished, a log will be outputted in the logs folder of your distribution.
Test Configuration
In a file called config-test.json within your distribution folder, fill in the information below. Note: aws information can be found here.
port
Port that local server listens to. ngrok exposes this port.