Skip to content
[In progress] Github API/OAuth through AWS Lambda
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
oauth
.gitignore
.nvmrc
.travis.yml
README.md
deploy.sh
event.json
template.yaml

README.md

github-activity-server

Build Status GitHub issues GitHub last commit

Requirements

Setup process

Local development

Invoking function locally using a local sample payload

sam local invoke --no-event OauthGithubAuthorizeFunction --parameter-overrides ParameterKey=GithubClientId,ParameterValue=foobar

Invoking function locally through local API Gateway

sam local start-api --parameter-overrides 'ParameterKey=GithubClientId,ParameterValue=XXXXXXX ParameterKey=GithubClientSecret,ParameterValue=XXXXXXX ParameterKey=GithubOatuhCallbackUrl,ParameterValue=http://127.0.0.1:8080/callback.html'

If the previous command ran successfully you should now be able to hit the following local endpoint to invoke your function http://localhost:3000/$FunctionPath

Packaging and deployment

Create S3 bucket:

aws s3 mb s3://BUCKET_NAME

Package Lambda (uploads to S3):

sam package \
    --output-template-file packaged.yaml \
    --s3-bucket BUCKET_NAME

Create Cloudformation Stack and deploy your SAM resources.

sam deploy \
    --template-file packaged.yaml \
    --stack-name github-activity-server \
    --capabilities CAPABILITY_IAM

After deployment is complete you can run the following command to retrieve the API Gateway Endpoint URL:

aws cloudformation describe-stacks \
    --stack-name github-activity-server \
    --query 'Stacks[].Outputs[?OutputKey==`ApiUrl`]' \
    --output table

Fetch, tail, and filter Lambda function logs

NOTE: This command works for all AWS Lambda functions; not just the ones you deploy using SAM.

sam logs -n OauthGithubAuthorizeFunction --stack-name github-activity-server --tail

Cleanup

In order to delete our Serverless Application recently deployed you can use the following AWS CLI Command:

aws cloudformation delete-stack --stack-name github-activity-server
You can’t perform that action at this time.