@emarketeer/ts-microservice-commons 10.4.0 → 10.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -412,6 +412,7 @@ const RECAP_DEV_TIMEOUT_WINDOW_SECONDS = 300;
412
412
  */
413
413
  const buildBaseEnvironment = (stage, scope) => ({
414
414
  STAGE: stage,
415
+ stage,
415
416
  NODE_ENV: stage === 'prod' ? 'production' : 'development',
416
417
  REGION: cdk.Stack.of(scope).region,
417
418
  });
@@ -536,11 +537,13 @@ function getHandlerBundlerPath() {
536
537
  * - Otherwise bundles `entryFile` via the project handler bundler at synth
537
538
  * time, with overrides applied on top of the defaults.
538
539
  *
539
- * An explicit `assetHash` is derived from the entry path + bundling overrides.
540
- * Without it, multiple handlers under the same source directory (the common
541
- * `src/handlers/` layout) would share an asset CDK would run `tryBundle`
542
- * once and reuse that asset for every other lambda, silently dropping
543
- * per-function overrides. The explicit hash gives each handler a unique asset.
540
+ * An explicit `assetHash` is derived per call from the entry path, bundling
541
+ * overrides, and a synth-time timestamp. The entry path is required so that
542
+ * multiple handlers under the same source directory (the common
543
+ * `src/handlers/` layout) don't collapse into one asset without it, CDK
544
+ * would run `tryBundle` once and silently reuse the same code for every
545
+ * lambda. The timestamp forces a fresh asset on every synth so each deploy
546
+ * uploads a clean rebuild rather than reusing a cached upload.
544
547
  */
545
548
  function resolveLambdaCode(options) {
546
549
  if (options.codePath) {
@@ -559,6 +562,7 @@ function resolveLambdaCode(options) {
559
562
  const hash = crypto.createHash('sha256')
560
563
  .update(entry)
561
564
  .update(JSON.stringify(overrides ?? {}))
565
+ .update(String(Date.now()))
562
566
  .digest('hex');
563
567
  const assetHash = `${handlerName}-${hash}`;
564
568
  return awsLambda.Code.fromAsset(path__namespace.dirname(entry), {