serverless-http icon indicating copy to clipboard operation
serverless-http copied to clipboard

Using this library with AWS function URLs?

Open ffMathy opened this issue 1 year ago • 3 comments

AWS Lambda Function URLs are different from regular API Gateway URLs, in that they support IAM authentication, and they are also cheaper to use.

Does this library have support for an AWS Lambda that has a function URL instead of an API Gateway integration?

ffMathy avatar Mar 21 '23 09:03 ffMathy

It will need some modification, I can't promise I will work on it but I might, otherwise PRs welcome

dougmoscrop avatar Mar 21 '23 13:03 dougmoscrop

It works fine on it's own (without IAM authentication), if you need to access the original event I suggest you use the options argument to amend the incoming req:

export const handler = serverless(app,{
  request(req, event, context) {
    // Append event & context to the request
    req.lambdaEvent = event;
    req.lambdaContext = context;
  },
});

Then in your framework, req.lambdaEvent would have the original event for you to access the IAM-specific request context you're after.

jdrydn avatar Jul 19 '23 18:07 jdrydn

I can confirm that Lambda Function URL's works fine.

ptz0n avatar Nov 08 '23 17:11 ptz0n