Skip to content

deddu/punbot-plus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

75 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

punbots

punbots$ sam build && sam deploy

The SAM CLI installs dependencies defined in $FUNC_NAME/package.json, creates a deployment package, and saves it in the .aws-sam/build folder.

Test a single function by invoking it directly with a test event. An event is a JSON document that represents the input that the function receives from the event source. Test events are included in the events folder in this project.

Run functions locally and invoke them with the sam local invoke command.

punbots$  sam build && env DEBUG='monthly:index' sam local invoke "ScoresMonthlyFunction" -e ./events/dydb-update.json

The SAM CLI can also emulate your application's API. Use the sam local start-api to run the API locally on port 3000.

punbots$ sam local start-api
punbots$ curl http://localhost:3000/

The SAM CLI reads the application template to determine the API's routes and the functions that they invoke. The Events property on each function's definition includes the route and method for each path.

      Events:
        HelloWorld:
          Type: Api
          Properties:
            Path: /hello
            Method: get

Fetch, tail, and filter Lambda function logs

logs are using the debug package. To enable, pass/add an environment variable to the lambda (maybe in the template) with debug = monthly:*,votes:* or whatever subset needed.

To simplify troubleshooting, SAM CLI has a command called sam logs. sam logs lets you fetch logs generated by your deployed Lambda function from the command line. In addition to printing the logs on the terminal, this command has several nifty features to help you quickly find the bug.

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

punbots$ sam logs -n HelloWorldFunction --stack-name punbots --tail

Unit tests

punbots$ cd hello-world
hello-world$ npm install
hello-world$ npm run test

About

serverless punbot on dynamodb

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published