I have an ExpressJS project with several routes
var app = new express();
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'jade');
app.use(express.static(path.join(__dirname, 'public')));
app.use('/car', car);
app.use('/bike', bike);
app.use('/bus', bus);
app.use('/train', train);
app.get('/',function(req,res){
res.render('layout', { title: 'app example' });
});
module.exports = app
I have deployed with ClaudiaJS to AWS Lambda and the deployment seems to work.
After that, I am configuring AWS API Gateway to invoke different resource paths in the Lambda Function. What I have found is that it properly works for the root path '/' but when I try to invoke a different resource path from API Gateway I get this error in API Gateway:
"You do not have permission to perform this action"
Additionally I get this message in the Lambda Function:
"The API with ID XXXXXXXXX does not include a resource with path /car having an integration arn:aws:lambda:myzone:XXXXXXXXXXXXX:function:functioname on the GET method."
Is this something possible to do currently with ClaudiaJS or even a supported configuration (multiple resource paths) in Lambda functions? Any experience?
Update 1: this seems to be possible for AWS Lambdas. See here: Is it possible to connect API gateway with node routes in AWS lambda? Not sure if ClaudiaJS can manage this use case
Update 2: ClaudiaJS confirms in their support group https://gitter.im/claudiajs/claudia that deploying a multi-route ExpressJS app to a single AWS Lambda is possible with their product and refers me to https://livebook.manning.com/#!/book/serverless-apps-with-node-and-claudiajs/chapter-13/v-5/167 So it looks some config/invokation error on my side
Update 3: Managed to invoke successfully 2 routes:
app.get('/test', function (req, res) {
res.send('Hello World test!');
});
app.get('/', function (req, res) {
res.send('Hello World!');
});
Getting {"message": "Internal server error"} for third route accessing MongoDB on EC2. Looks a permission issue.