lambda-api icon indicating copy to clipboard operation
lambda-api copied to clipboard

"error": "Method not allowed"

Open raja-vcomply opened this issue 3 years ago • 4 comments

When i am hitting the route its returning "method not allowed"

raja-vcomply avatar May 29 '21 08:05 raja-vcomply

@jthomerson @jeremydaly help me pls

raja-vcomply avatar May 30 '21 07:05 raja-vcomply

Hey @raja-vcomply!

Can you post some sample code?

jeremydaly avatar May 30 '21 11:05 jeremydaly

@raja-vcomply - I just ran into this too. I was using API Gateway V2, but it appears lambda-api won't support the v2.0 event payload format until 0.11 per this comment:

v0.11 supports Payload V2 and should be available shortly.

Originally posted by @jeremydaly in https://github.com/jeremydaly/lambda-api/issues/174#issuecomment-808725167

If this sounds like your case, you can force the API Gateway V2 to use the v1.0 payload format in the settings. I also noticed the new $default route did not work with lambda-api, and had to configure / and /{proxy+} routes instead.

codyfyi avatar Jun 09 '21 23:06 codyfyi

If I understand the situation correctly @codyfyi, I believe it does support v2.0 events. Your code should be this.

const app = api.default({version: 'v2.0'});

mattwen-amzn avatar Jul 17 '21 02:07 mattwen-amzn