I am using Claduiajs to create lambda functions and i'm still discovering what it can and can't do, so far I was able to create a lambda function that connects to AWS DynamoDB and everything is working as expected, but when I try adding in an API by using Claudia API Builder by following this tutorial the trigger doesn't get added to the lambda function.
The steps I took after setting npm and installing the dependencies were:
Step 1: Write this function up in main.js
:
const AWS = require('aws-sdk'); // Used for DynamoDB
const performance = require('performance-now'); // Used to measure performance
const deepExtend = require('deep-extend'); // Used to deep extend json arrays
const docClient = new AWS.DynamoDB.DocumentClient({region: 'ap-southeast-2'});
const TableName = 'Agent-commands';
var ApiBuilder = require('claudia-api-builder'),
api = new ApiBuilder();
module.exports = api;
api.post('/',function(request){
console.info('request',request);
});
Step 2: Run this command to create the function & api claudia create --name add-command-for-agent --region ap-southeast-2 --api-module main --timeout 10 --policies policies/*.json
Once I do that I get this in the terminal:
saving configuration
{
"lambda": {
"role": "add-command-for-agent-executor",
"name": "add-command-for-agent",
"region": "ap-southeast-2"
},
"api": {
"id": "l223cd1rl7",
"module": "main",
"url": "https://l223cd1rl7.execute-api.ap-southeast-2.amazonaws.com/latest"
}
}
When I go to that url I get {"message":"Missing Authentication Token"}
When I check my claduia.json
file that's created by the create command i don't see the url in there, just the id and module.
When I check the lambda function on the AWS console there are no triggers attached.
Am I doing something wrong or is that a bug?