3 ms·
Regarding bullet 4. Provisioned Concurrency: If you use AWS SDK v3 and use node.js runtime 14.x, you can use top level await. Using top level await lets you mo
by koprulusector 4y ago
Regarding bullet 4. Provisioned Concurrency:
If you use AWS SDK v3 and use node.js runtime 14.x, you can use top level await. Using top level await lets you more easily do async initializations outside your handler code, before invocation. This has a major benefit of reducing cold start latency when using provisioned concurrency.
See https://aws.amazon.com/blogs/compute/using-node-js-es-modules-and-top-level-await-in-aws-lambda/ https://aws.amazon.com/blogs/compute/using-node-js-es-module...
- bilalq 4y agoThat blog post author is mistaken. You can fire off async stuff outside of your handler just fine without AWS SDK v3 or top level await. Just run an async IIFE and assign it to a variable outside your handler. You can await that promise when you need it in your handler, but it kicked off running before your handler was invoked.