@remit/smtp-worker 0.0.13 → 0.0.14

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remit/smtp-worker",
3
- "version": "0.0.13",
3
+ "version": "0.0.14",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "exports": {
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env node
2
+ import { randomUUID } from "node:crypto";
2
3
  import {
3
4
  DeleteMessageCommand,
4
5
  ReceiveMessageCommand,
@@ -46,11 +47,16 @@ process.on("SIGTERM", () => {
46
47
  isShuttingDown = true;
47
48
  });
48
49
 
49
- // Minimal Lambda Context: `withTelemetry` only reads `functionName`, for the
50
- // line it logs per invocation; the prod handler never touches the rest.
51
- const lambdaContext = {
52
- functionName: `e2e-smtp-worker-${queueName}`,
53
- } as Context;
50
+ // Minimal Lambda Context: `withTelemetry` reads `functionName` for the line it
51
+ // logs per invocation and `awsRequestId` for the scope it opens around it, so
52
+ // every line one batch produces shares a `requestId` (deploy/vps/README.md,
53
+ // "Logs"). Minted per batch, like the production poller does — a context built
54
+ // once would put the whole run under one id, which correlates nothing.
55
+ const nextContext = (): Context =>
56
+ ({
57
+ functionName: `e2e-smtp-worker-${queueName}`,
58
+ awsRequestId: randomUUID(),
59
+ }) as Context;
54
60
 
55
61
  const pollQueue = async (): Promise<void> => {
56
62
  log.info("Worker started, polling...", { maxMessages });
@@ -115,7 +121,7 @@ const pollQueue = async (): Promise<void> => {
115
121
  })),
116
122
  };
117
123
 
118
- const result = (await handler(event, lambdaContext)) as
124
+ const result = (await handler(event, nextContext())) as
119
125
  | SQSBatchResponse
120
126
  | undefined;
121
127