spring-media / aws-lambda-router

Improved routing for AWS Lambda like SNS and ApiGateway
Apache License 2.0
98 stars 52 forks source link

Remove dynamic imports #66

Closed bohjak closed 2 years ago

bohjak commented 3 years ago

Based on suggestion from @TomiTakussaari (https://github.com/spring-media/aws-lambda-router/issues/65).

I kept the dynamic require as a fall back since the handler tests are basically built around the ability to easily mock a processor and it shouldn't interfere with the main goal of making the library work with esbuild.

codecov-commenter commented 3 years ago

Codecov Report

Merging #66 (8d00302) into master (6527988) will increase coverage by 0.18%. The diff coverage is 91.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #66      +/-   ##
==========================================
+ Coverage   85.76%   85.94%   +0.18%     
==========================================
  Files           6        6              
  Lines         295      306      +11     
  Branches       93       94       +1     
==========================================
+ Hits          253      263      +10     
- Misses         42       43       +1     
Impacted Files Coverage Δ
index.ts 80.48% <91.66%> (+3.82%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 6527988...8d00302. Read the comment docs.

chgohlke commented 3 years ago

Hi @jamesbohacek, thanks for your PR. I am not sure if we need the dynamic imports yet. But we can always remove them later.

Can you please add a small test that tests the new functionality? A thanks in advance :blush:

Chansen88 commented 2 years ago

This would be very helpful for me due to issues with esbuild.

givethemheller commented 2 years ago

This would be very helpful for me due to issues with esbuild.

What issues are you having with ESBuild right now? I've just setup and I am getting a warning when I try to execute my lambda. Note, I am using typescript

"Error: The event processor 'proxyIntegration', that is mentioned in the routerConfig, cannot be instantiated (Error: Cannot find module './lib/proxyIntegration'
givethemheller commented 2 years ago

@chgohlke I can confirm that this fixed issues with me using a standard esbuild as prescribed by AWS documentation.

Without the fix, I was receiving the error above and I am now properly executing. Can this get merged?

Xavier59 commented 2 years ago

Bump. Same error there, and esbuild is the recommended way to bundle typescript as per AWS documentation.

bohjak commented 2 years ago

Seems I kinda forgot about this PR :sweat_smile: I'm no longer using this library and don't have time to spend on this.

So, I'll close this PR, but anybody interested is welcome to copy/adapt/improve it and make a new PR. The code is mostly taken from @TomiTakussaari's issue anyway.