Tuesday 23 May 2017

aws-serverless-express via AWS API gateway asking for authentication even not setup for that

sorry for such 101 question but I'm kinda new with AWS, NodeJS and Express.

I'm setting up a basic serverless API Gateway:

index.js

import AwsServerlessExpress from 'aws-serverless-express';
import App from './src/app';

const server = AwsServerlessExpress.createServer(App);

exports.handler = (event, context) => AwsServerlessExpress.proxy(server, event, context);

./src/app.js

import Express from 'express';
import BodyParser from 'body-parser';
import AwsServerlessExpressMiddleware from 'aws-serverless-express/middleware';

let app = Express();

app.use(BodyParser.json());
app.use(BodyParser.urlencoded({extended: true}));
app.use(AwsServerlessExpressMiddleware.eventContext());

app.get('/status', (req, res) => {
    res.json({ a: "status" });
});

app.get('/', (req, res) => {
    res.json({ a: "root" });
});

export default app;

And on the API Gateway console interface:

alt text alt text alt text

What's the problem here? If you need more information let me know please.

Thanks.



via Marcelo Filho

No comments:

Post a Comment