dherault / serverless-offline

Emulate AWS λ and API Gateway locally when developing your Serverless project
MIT License
5.16k stars 794 forks source link

fix: skip adding authorizer to event if no authorizer is configured #1786

Closed cnuss closed 1 month ago

cnuss commented 1 month ago

Description

AWS API Gateway does not include the event.requestContext.authorizer field if there is no authorizer configured for the function.

This PR deletes the event.requestContext.authorizer field if the function does not have an authorizer.

Motivation and Context

How Has This Been Tested?

I've written tests and included them in this PR. Please let me know if you want me to kick the tires in any other ways!

cnuss commented 1 month ago

Hi @DorianMazur i have another one for you to 👀 !

cnuss commented 1 month ago

thank you! i ran a limited set of the tests locally until it worked so i must have missed customAuthenticationProvider