skuba 12.1.0-no-sync-in-promise-iterable-20250801120322 → 12.1.0

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.
Files changed (91) hide show
  1. package/README.md +1 -2
  2. package/config/tsconfig.json +3 -2
  3. package/lib/cli/build/assets.js +1 -1
  4. package/lib/cli/build/assets.js.map +2 -2
  5. package/lib/cli/build/tsc.d.ts +5 -1
  6. package/lib/cli/build/tsc.js +12 -0
  7. package/lib/cli/build/tsc.js.map +3 -3
  8. package/lib/cli/configure/analyseDependencies.d.ts +2 -2
  9. package/lib/cli/configure/analyseDependencies.js.map +1 -1
  10. package/lib/cli/configure/analysis/package.d.ts +1 -1
  11. package/lib/cli/configure/analysis/package.js +1 -1
  12. package/lib/cli/configure/analysis/package.js.map +2 -2
  13. package/lib/cli/configure/ensureTemplateCompletion.d.ts +2 -2
  14. package/lib/cli/configure/ensureTemplateCompletion.js.map +1 -1
  15. package/lib/cli/configure/getEntryPoint.d.ts +2 -2
  16. package/lib/cli/configure/getEntryPoint.js.map +1 -1
  17. package/lib/cli/configure/getProjectType.d.ts +2 -2
  18. package/lib/cli/configure/getProjectType.js.map +1 -1
  19. package/lib/cli/configure/processing/package.js +8 -2
  20. package/lib/cli/configure/processing/package.js.map +2 -2
  21. package/lib/cli/init/getConfig.js +1 -1
  22. package/lib/cli/init/getConfig.js.map +2 -2
  23. package/lib/cli/lint/internal.js +1 -1
  24. package/lib/cli/lint/internal.js.map +2 -2
  25. package/lib/cli/lint/internalLints/upgrade/index.d.ts +2 -2
  26. package/lib/cli/lint/internalLints/upgrade/index.js.map +1 -1
  27. package/lib/cli/lint/internalLints/upgrade/patches/12.0.2/unhandledRejections.js +1 -1
  28. package/lib/cli/lint/internalLints/upgrade/patches/12.0.2/unhandledRejections.js.map +1 -1
  29. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/upgradeESLint.js +1 -1
  30. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/upgradeESLint.js.map +2 -2
  31. package/lib/cli/node/index.js +6 -0
  32. package/lib/cli/node/index.js.map +2 -2
  33. package/lib/cli/start/index.js +6 -0
  34. package/lib/cli/start/index.js.map +2 -2
  35. package/lib/cli/test/index.d.ts +1 -1
  36. package/lib/cli/test/index.js +18 -4
  37. package/lib/cli/test/index.js.map +2 -2
  38. package/lib/utils/args.d.ts +2 -0
  39. package/lib/utils/args.js +5 -0
  40. package/lib/utils/args.js.map +2 -2
  41. package/lib/utils/manifest.d.ts +1 -1
  42. package/lib/utils/manifest.js +1 -1
  43. package/lib/utils/manifest.js.map +2 -2
  44. package/package.json +13 -13
  45. package/template/base/_pnpm-workspace.yaml +1 -0
  46. package/template/base/jest.setup.ts +1 -1
  47. package/template/express-rest-api/.buildkite/pipeline.yml +6 -0
  48. package/template/express-rest-api/.env +1 -1
  49. package/template/express-rest-api/.gantry/dev.yml +5 -1
  50. package/template/express-rest-api/.gantry/prod.yml +5 -1
  51. package/template/express-rest-api/Dockerfile +1 -1
  52. package/template/express-rest-api/README.md +5 -5
  53. package/template/express-rest-api/gantry.apply.yml +17 -1
  54. package/template/express-rest-api/package.json +11 -5
  55. package/template/express-rest-api/src/api/healthCheck.ts +2 -2
  56. package/template/express-rest-api/src/config.ts +7 -7
  57. package/template/express-rest-api/src/framework/logging.ts +11 -7
  58. package/template/express-rest-api/src/framework/metrics.ts +1 -1
  59. package/template/express-rest-api/src/tracing.ts +56 -0
  60. package/template/greeter/README.md +2 -2
  61. package/template/greeter/package.json +2 -2
  62. package/template/koa-rest-api/.buildkite/pipeline.yml +6 -0
  63. package/template/koa-rest-api/.env +1 -1
  64. package/template/koa-rest-api/.gantry/dev.yml +3 -3
  65. package/template/koa-rest-api/.gantry/prod.yml +3 -3
  66. package/template/koa-rest-api/README.md +6 -6
  67. package/template/koa-rest-api/gantry.apply.yml +15 -3
  68. package/template/koa-rest-api/package.json +5 -6
  69. package/template/koa-rest-api/src/api/healthCheck.ts +2 -2
  70. package/template/koa-rest-api/src/config.ts +7 -7
  71. package/template/koa-rest-api/src/framework/logging.ts +12 -8
  72. package/template/koa-rest-api/src/framework/metrics.ts +1 -1
  73. package/template/koa-rest-api/src/framework/server.test.ts +7 -8
  74. package/template/koa-rest-api/src/framework/server.ts +1 -4
  75. package/template/lambda-sqs-worker-cdk/.buildkite/pipeline.yml +6 -2
  76. package/template/lambda-sqs-worker-cdk/.env +1 -1
  77. package/template/lambda-sqs-worker-cdk/README.md +8 -8
  78. package/template/lambda-sqs-worker-cdk/infra/__snapshots__/appStack.test.ts.snap +36 -10
  79. package/template/lambda-sqs-worker-cdk/infra/appStack.test.ts +5 -8
  80. package/template/lambda-sqs-worker-cdk/infra/appStack.ts +11 -5
  81. package/template/lambda-sqs-worker-cdk/infra/config.ts +27 -18
  82. package/template/lambda-sqs-worker-cdk/infra/index.ts +1 -1
  83. package/template/lambda-sqs-worker-cdk/package.json +6 -6
  84. package/template/lambda-sqs-worker-cdk/src/app.test.ts +4 -4
  85. package/template/lambda-sqs-worker-cdk/src/config.ts +11 -16
  86. package/template/lambda-sqs-worker-cdk/src/framework/handler.test.ts +2 -2
  87. package/template/lambda-sqs-worker-cdk/src/framework/handler.ts +8 -21
  88. package/template/lambda-sqs-worker-cdk/src/framework/logging.ts +12 -8
  89. package/template/lambda-sqs-worker-cdk/src/framework/metrics.ts +1 -4
  90. package/template/oss-npm-package/.github/workflows/release.yml +1 -1
  91. package/template/oss-npm-package/.github/workflows/validate.yml +1 -1
@@ -180,28 +180,29 @@ exports[`returns expected CloudFormation stack for dev 1`] = `
180
180
  "Ref": "datadogapikeysecret046FEF06",
181
181
  },
182
182
  "DD_CAPTURE_LAMBDA_PAYLOAD": "false",
183
+ "DD_ENV": "development",
183
184
  "DD_FLUSH_TO_LOG": "false",
184
185
  "DD_LAMBDA_HANDLER": "index.handler",
185
186
  "DD_LOGS_INJECTION": "false",
186
187
  "DD_MERGE_XRAY_TRACES": "false",
187
188
  "DD_SERVERLESS_APPSEC_ENABLED": "false",
188
189
  "DD_SERVERLESS_LOGS_ENABLED": "false",
190
+ "DD_SERVICE": "serviceName",
189
191
  "DD_SITE": "datadoghq.com",
190
192
  "DD_TRACE_CLOUD_REQUEST_PAYLOAD_TAGGING": "$.*",
191
193
  "DD_TRACE_CLOUD_RESPONSE_PAYLOAD_TAGGING": "$.*",
192
194
  "DD_TRACE_ENABLED": "true",
195
+ "DD_VERSION": "local",
196
+ "DEPLOYMENT": "dev",
193
197
  "DESTINATION_SNS_TOPIC_ARN": {
194
198
  "Ref": "destinationtopicDCE2E0B8",
195
199
  },
196
- "ENVIRONMENT": "dev",
197
200
  "NODE_ENV": "production",
198
201
  "NODE_OPTIONS": "--enable-source-maps",
199
- "SERVICE": "serviceName",
200
- "VERSION": "local",
201
202
  },
202
203
  },
203
204
  "FunctionName": "serviceName",
204
- "Handler": "node_modules/datadog-lambda-js/dist/handler.handler",
205
+ "Handler": "/opt/nodejs/node_modules/datadog-lambda-js/handler.handler",
205
206
  "KmsKeyArn": {
206
207
  "Fn::GetAtt": [
207
208
  "kmskey49FBC3B3",
@@ -209,6 +210,18 @@ exports[`returns expected CloudFormation stack for dev 1`] = `
209
210
  ],
210
211
  },
211
212
  "Layers": [
213
+ {
214
+ "Fn::Join": [
215
+ "",
216
+ [
217
+ "arn:aws:lambda:",
218
+ {
219
+ "Ref": "AWS::Region",
220
+ },
221
+ ":464622532012:layer:Datadog-Node22-x:x",
222
+ ],
223
+ ],
224
+ },
212
225
  {
213
226
  "Fn::Join": [
214
227
  "",
@@ -222,7 +235,7 @@ exports[`returns expected CloudFormation stack for dev 1`] = `
222
235
  ],
223
236
  },
224
237
  ],
225
- "ReservedConcurrentExecutions": 2,
238
+ "ReservedConcurrentExecutions": 3,
226
239
  "Role": {
227
240
  "Fn::GetAtt": [
228
241
  "workerServiceRole2130CC7F",
@@ -920,28 +933,29 @@ exports[`returns expected CloudFormation stack for prod 1`] = `
920
933
  "Ref": "datadogapikeysecret046FEF06",
921
934
  },
922
935
  "DD_CAPTURE_LAMBDA_PAYLOAD": "false",
936
+ "DD_ENV": "production",
923
937
  "DD_FLUSH_TO_LOG": "false",
924
938
  "DD_LAMBDA_HANDLER": "index.handler",
925
939
  "DD_LOGS_INJECTION": "false",
926
940
  "DD_MERGE_XRAY_TRACES": "false",
927
941
  "DD_SERVERLESS_APPSEC_ENABLED": "false",
928
942
  "DD_SERVERLESS_LOGS_ENABLED": "false",
943
+ "DD_SERVICE": "serviceName",
929
944
  "DD_SITE": "datadoghq.com",
930
945
  "DD_TRACE_CLOUD_REQUEST_PAYLOAD_TAGGING": "$.*",
931
946
  "DD_TRACE_CLOUD_RESPONSE_PAYLOAD_TAGGING": "$.*",
932
947
  "DD_TRACE_ENABLED": "true",
948
+ "DD_VERSION": "local",
949
+ "DEPLOYMENT": "prod",
933
950
  "DESTINATION_SNS_TOPIC_ARN": {
934
951
  "Ref": "destinationtopicDCE2E0B8",
935
952
  },
936
- "ENVIRONMENT": "prod",
937
953
  "NODE_ENV": "production",
938
954
  "NODE_OPTIONS": "--enable-source-maps",
939
- "SERVICE": "serviceName",
940
- "VERSION": "local",
941
955
  },
942
956
  },
943
957
  "FunctionName": "serviceName",
944
- "Handler": "node_modules/datadog-lambda-js/dist/handler.handler",
958
+ "Handler": "/opt/nodejs/node_modules/datadog-lambda-js/handler.handler",
945
959
  "KmsKeyArn": {
946
960
  "Fn::GetAtt": [
947
961
  "kmskey49FBC3B3",
@@ -949,6 +963,18 @@ exports[`returns expected CloudFormation stack for prod 1`] = `
949
963
  ],
950
964
  },
951
965
  "Layers": [
966
+ {
967
+ "Fn::Join": [
968
+ "",
969
+ [
970
+ "arn:aws:lambda:",
971
+ {
972
+ "Ref": "AWS::Region",
973
+ },
974
+ ":464622532012:layer:Datadog-Node22-x:x",
975
+ ],
976
+ ],
977
+ },
952
978
  {
953
979
  "Fn::Join": [
954
980
  "",
@@ -1104,7 +1130,7 @@ exports[`returns expected CloudFormation stack for prod 1`] = `
1104
1130
  "ReportBatchItemFailures",
1105
1131
  ],
1106
1132
  "ScalingConfig": {
1107
- "MaximumConcurrency": 20,
1133
+ "MaximumConcurrency": 19,
1108
1134
  },
1109
1135
  "Tags": [
1110
1136
  {
@@ -15,11 +15,11 @@ jest.useFakeTimers({
15
15
  now: new Date(currentDate),
16
16
  });
17
17
 
18
- const originalEnv = process.env.ENVIRONMENT;
18
+ const originalDeployment = process.env.DEPLOYMENT;
19
19
  const originalVersion = process.env.VERSION;
20
20
 
21
21
  afterAll(() => {
22
- process.env.ENVIRONMENT = originalEnv;
22
+ process.env.DEPLOYMENT = originalDeployment;
23
23
  process.env.VERSION = originalVersion;
24
24
  });
25
25
 
@@ -29,8 +29,8 @@ afterEach(() => {
29
29
 
30
30
  it.each(['dev', 'prod'])(
31
31
  'returns expected CloudFormation stack for %s',
32
- async (env) => {
33
- process.env.ENVIRONMENT = env;
32
+ async (deployment) => {
33
+ process.env.DEPLOYMENT = deployment;
34
34
  process.env.VERSION = 'local';
35
35
 
36
36
  const { AppStack } = await import('./appStack.js');
@@ -69,10 +69,7 @@ it.each(['dev', 'prod'])(
69
69
  /"DD_TAGS":"git.commit.sha:([0-9a-f]+),git.repository_url:([^\"]+)",/g,
70
70
  '',
71
71
  )
72
- .replaceAll(
73
- /(layer:Datadog-Extension-.+?:)\d+/g,
74
- (_, layer) => `${layer}x`,
75
- );
72
+ .replaceAll(/(layer:Datadog-[^-]+-.+?:)\d+/g, (_, layer) => `${layer}x`);
76
73
  expect(JSON.parse(json)).toMatchSnapshot();
77
74
  },
78
75
  );
@@ -19,7 +19,10 @@ import { DatadogLambda } from 'datadog-cdk-constructs-v2';
19
19
  import { config } from './config.js';
20
20
 
21
21
  // Updated by https://github.com/seek-oss/rynovate
22
- const DATADOG_EXTENSION_LAYER_VERSION = 64;
22
+ const DATADOG_EXTENSION_LAYER_VERSION = 84;
23
+
24
+ // Updated by https://github.com/seek-oss/rynovate
25
+ const DATADOG_NODE_LAYER_VERSION = 126;
23
26
 
24
27
  export class AppStack extends Stack {
25
28
  constructor(scope: Construct, id: string, props?: StackProps) {
@@ -95,7 +98,6 @@ export class AppStack extends Stack {
95
98
  target: 'node22',
96
99
  // aws-sdk-v3 is set as an external module by default, but we want it to be bundled with the function
97
100
  externalModules: [],
98
- nodeModules: ['datadog-lambda-js', 'dd-trace'],
99
101
  },
100
102
  functionName: '<%- serviceName %>',
101
103
  environment: {
@@ -127,11 +129,15 @@ export class AppStack extends Stack {
127
129
  );
128
130
 
129
131
  const datadog = new DatadogLambda(this, 'datadog', {
132
+ env: config.env,
133
+ service: config.service,
134
+ version: config.version,
135
+
130
136
  apiKeySecret: datadogSecret,
131
- addLayers: false,
132
137
  enableDatadogLogs: false,
133
- flushMetricsToLogs: false,
134
138
  extensionLayerVersion: DATADOG_EXTENSION_LAYER_VERSION,
139
+ flushMetricsToLogs: false,
140
+ nodeLayerVersion: DATADOG_NODE_LAYER_VERSION,
135
141
  });
136
142
 
137
143
  datadog.addLambdaFunctions([worker]);
@@ -142,8 +148,8 @@ export class AppStack extends Stack {
142
148
 
143
149
  workerDeployment.alias.addEventSource(
144
150
  new aws_lambda_event_sources.SqsEventSource(queue, {
145
- maxConcurrency: config.workerLambda.reservedConcurrency,
146
151
  batchSize: config.workerLambda.batchSize,
152
+ maxConcurrency: config.workerLambda.reservedConcurrency - 1, // Ensure we have capacity reserved for our blue/green deployment
147
153
  reportBatchItemFailures: true,
148
154
  }),
149
155
  );
@@ -1,55 +1,64 @@
1
1
  import { Env } from 'skuba-dive';
2
2
 
3
- const ENVIRONMENTS = ['dev', 'prod'] as const;
3
+ type Deployment = (typeof deployments)[number];
4
4
 
5
- type Environment = (typeof ENVIRONMENTS)[number];
5
+ const deployments = ['dev', 'prod'] as const;
6
6
 
7
- const environment = Env.oneOf(ENVIRONMENTS)('ENVIRONMENT');
7
+ const deployment = Env.oneOf(deployments)('DEPLOYMENT');
8
8
 
9
9
  interface Config {
10
- appName: string;
10
+ env: 'development' | 'production';
11
+ service: string;
12
+ version: string;
13
+
11
14
  workerLambda: {
12
15
  batchSize: number;
13
16
  reservedConcurrency: number;
14
17
  environment: {
15
- ENVIRONMENT: Environment;
16
- SERVICE: string;
17
- VERSION: string;
18
+ DEPLOYMENT: Deployment;
18
19
  };
19
20
  };
21
+
20
22
  datadogApiKeySecretArn: string;
21
23
  sourceSnsTopicArn: string;
22
24
  }
23
25
 
24
- const configs: Record<Environment, Config> = {
26
+ const service = '<%- serviceName %>';
27
+ const version = Env.string('VERSION');
28
+
29
+ const configs: Record<Deployment, Config> = {
25
30
  dev: {
26
- appName: '<%- serviceName %>',
31
+ env: 'development',
32
+ service,
33
+ version,
34
+
27
35
  workerLambda: {
28
36
  batchSize: 10,
29
- reservedConcurrency: 2,
37
+ reservedConcurrency: 3,
30
38
  environment: {
31
- ENVIRONMENT: 'dev',
32
- SERVICE: '<%- serviceName %>',
33
- VERSION: Env.string('VERSION', { default: 'local' }),
39
+ DEPLOYMENT: 'dev',
34
40
  },
35
41
  },
42
+
36
43
  datadogApiKeySecretArn: 'TODO: datadogApiKeySecretArn',
37
44
  sourceSnsTopicArn: 'TODO: sourceSnsTopicArn',
38
45
  },
39
46
  prod: {
40
- appName: '<%- serviceName %>',
47
+ env: 'production',
48
+ service,
49
+ version,
50
+
41
51
  workerLambda: {
42
52
  batchSize: 10,
43
53
  reservedConcurrency: 20,
44
54
  environment: {
45
- ENVIRONMENT: 'prod',
46
- SERVICE: '<%- serviceName %>',
47
- VERSION: Env.string('VERSION', { default: 'local' }),
55
+ DEPLOYMENT: 'prod',
48
56
  },
49
57
  },
58
+
50
59
  datadogApiKeySecretArn: 'TODO: datadogApiKeySecretArn',
51
60
  sourceSnsTopicArn: 'TODO: sourceSnsTopicArn',
52
61
  },
53
62
  };
54
63
 
55
- export const config: Config = configs[environment];
64
+ export const config: Config = configs[deployment];
@@ -7,7 +7,7 @@ import { config } from './config.js';
7
7
  const app = new App();
8
8
 
9
9
  const appStack = new AppStack(app, 'appStack', {
10
- stackName: config.appName,
10
+ stackName: config.service,
11
11
  tags: {
12
12
  'seek:source:url': 'https://github.com/SEEK-Jobs/<%- repoName %>',
13
13
  // 'seek:system:name': 'TODO: https://rfc.skinfra.xyz/RFC051-AWS-Tagging-Standard.html#tagging-schema',
@@ -18,9 +18,7 @@
18
18
  "@aws-sdk/client-lambda": "^3.363.0",
19
19
  "@aws-sdk/client-sns": "^3.363.0",
20
20
  "@seek/aws-codedeploy-hooks": "^2.0.0",
21
- "@seek/logger": "^10.0.0",
22
- "datadog-lambda-js": "^10.0.0",
23
- "dd-trace": "^5.0.0",
21
+ "@seek/logger": "11.0.0",
24
22
  "skuba-dive": "^2.0.0",
25
23
  "zod": "^4.0.0"
26
24
  },
@@ -35,11 +33,13 @@
35
33
  "aws-sdk-client-mock-jest": "^4.0.0",
36
34
  "chance": "^1.1.8",
37
35
  "constructs": "^10.0.17",
38
- "datadog-cdk-constructs-v2": "^2.0.0",
36
+ "datadog-cdk-constructs-v2": "^3.0.0",
37
+ "datadog-lambda-js": "^12.0.0",
38
+ "dd-trace": "^5.0.0",
39
39
  "pino-pretty": "^13.0.0",
40
- "skuba": "12.1.0-no-sync-in-promise-iterable-20250801120322"
40
+ "skuba": "*"
41
41
  },
42
- "packageManager": "pnpm@10.13.1",
42
+ "packageManager": "pnpm@10.14.0",
43
43
  "engines": {
44
44
  "node": ">=22"
45
45
  }
@@ -107,7 +107,7 @@ describe('handler', () => {
107
107
  expect(stdoutMock.calls).toMatchObject([
108
108
  { count: 2, level: 20, msg: 'Received jobs' },
109
109
  {
110
- err: {
110
+ error: {
111
111
  name: 'ZodError',
112
112
  type: 'ZodError',
113
113
  },
@@ -151,7 +151,7 @@ describe('handler', () => {
151
151
  expect(stdoutMock.calls).toMatchObject([
152
152
  { count: 1, level: 20, msg: 'Received jobs' },
153
153
  {
154
- err: {
154
+ error: {
155
155
  message: err.message,
156
156
  type: 'Error',
157
157
  },
@@ -181,7 +181,7 @@ describe('handler', () => {
181
181
  msg: 'Received jobs',
182
182
  },
183
183
  {
184
- err: {
184
+ error: {
185
185
  message: err.message,
186
186
  type: 'Error',
187
187
  },
@@ -203,7 +203,7 @@ describe('handler', () => {
203
203
 
204
204
  expect(stdoutMock.calls).toMatchObject([
205
205
  {
206
- err: {
206
+ error: {
207
207
  message: 'Received 0 records',
208
208
  type: 'Error',
209
209
  },
@@ -1,27 +1,25 @@
1
1
  import { Env } from 'skuba-dive';
2
2
 
3
3
  interface Config {
4
- environment: Environment;
4
+ deployment: Deployment;
5
5
 
6
6
  logLevel: string;
7
- metrics: boolean;
8
7
  name: string;
9
8
  version: string;
10
9
 
11
10
  destinationSnsTopicArn: string;
12
11
  }
13
12
 
14
- type Environment = (typeof environments)[number];
13
+ type Deployment = (typeof deployments)[number];
15
14
 
16
- const environments = ['local', 'test', 'dev', 'prod'] as const;
15
+ const deployments = ['local', 'test', 'dev', 'prod'] as const;
17
16
 
18
- const environment = Env.oneOf(environments)('ENVIRONMENT');
17
+ const deployment = Env.oneOf(deployments)('DEPLOYMENT');
19
18
 
20
19
  /* istanbul ignore next: config verification makes more sense in a smoke test */
21
- const configs: Record<Environment, () => Omit<Config, 'environment'>> = {
20
+ const configs: Record<Deployment, () => Omit<Config, 'deployment'>> = {
22
21
  local: () => ({
23
22
  logLevel: 'debug',
24
- metrics: false,
25
23
  name: '<%- serviceName %>',
26
24
  version: 'local',
27
25
 
@@ -30,7 +28,6 @@ const configs: Record<Environment, () => Omit<Config, 'environment'>> = {
30
28
 
31
29
  test: () => ({
32
30
  logLevel: Env.string('LOG_LEVEL', { default: 'debug' }),
33
- metrics: false,
34
31
  name: '<%- serviceName %>',
35
32
  version: 'test',
36
33
 
@@ -39,24 +36,22 @@ const configs: Record<Environment, () => Omit<Config, 'environment'>> = {
39
36
 
40
37
  dev: () => ({
41
38
  logLevel: 'debug',
42
- metrics: true,
43
- name: Env.string('SERVICE'),
44
- version: Env.string('VERSION'),
39
+ name: Env.string('DD_SERVICE'),
40
+ version: Env.string('DD_VERSION'),
45
41
 
46
42
  destinationSnsTopicArn: Env.string('DESTINATION_SNS_TOPIC_ARN'),
47
43
  }),
48
44
 
49
45
  prod: () => ({
50
46
  logLevel: 'info',
51
- metrics: true,
52
- name: Env.string('SERVICE'),
53
- version: Env.string('VERSION'),
47
+ name: Env.string('DD_SERVICE'),
48
+ version: Env.string('DD_VERSION'),
54
49
 
55
50
  destinationSnsTopicArn: Env.string('DESTINATION_SNS_TOPIC_ARN'),
56
51
  }),
57
52
  };
58
53
 
59
54
  export const config: Config = {
60
- ...configs[environment](),
61
- environment,
55
+ ...configs[deployment](),
56
+ deployment,
62
57
  };
@@ -52,7 +52,7 @@ describe('createHandler', () => {
52
52
  expect(stdoutMock.calls).toMatchObject([
53
53
  {
54
54
  awsRequestId: '-',
55
- err: {
55
+ error: {
56
56
  message: err.message,
57
57
  type: 'Error',
58
58
  },
@@ -74,7 +74,7 @@ describe('createHandler', () => {
74
74
  expect(stdoutMock.calls).toMatchObject([
75
75
  {
76
76
  awsRequestId: '-',
77
- err: {
77
+ error: {
78
78
  message: err.message,
79
79
  type: 'Error',
80
80
  },
@@ -5,9 +5,7 @@ import type {
5
5
  SQSEvent,
6
6
  SQSRecord,
7
7
  } from 'aws-lambda';
8
- import { datadog } from 'datadog-lambda-js';
9
8
 
10
- import { config } from 'src/config.js';
11
9
  import { lambdaContext, logger, recordContext } from 'src/framework/logging.js';
12
10
 
13
11
  type Handler<Event, Output> = (
@@ -15,21 +13,11 @@ type Handler<Event, Output> = (
15
13
  ctx: LambdaContext,
16
14
  ) => Promise<Output>;
17
15
 
18
- /**
19
- * Conditionally applies the Datadog wrapper to a Lambda handler.
20
- *
21
- * This also "fixes" its broken type definitions.
22
- */
23
- const withDatadog = <Event, Output = unknown>(
24
- fn: Handler<Event, Output>,
25
- ): Handler<Event, Output> =>
26
- // istanbul ignore next
27
- config.metrics ? (datadog(fn) as Handler<Event, Output>) : fn;
28
-
29
- export const createHandler = <Event extends SQSEvent, Output = unknown>(
30
- fn: (event: Event, ctx: LambdaContext) => Promise<Output>,
31
- ) =>
32
- withDatadog<Event>((event, ctx) =>
16
+ export const createHandler =
17
+ <Event extends SQSEvent, Output = unknown>(
18
+ fn: (event: Event, ctx: LambdaContext) => Promise<Output>,
19
+ ): Handler<Event, Output> =>
20
+ async (event, ctx) =>
33
21
  lambdaContext.run({ awsRequestId: ctx.awsRequestId }, async () => {
34
22
  try {
35
23
  const output = await fn(event, ctx);
@@ -38,12 +26,11 @@ export const createHandler = <Event extends SQSEvent, Output = unknown>(
38
26
 
39
27
  return output;
40
28
  } catch (err) {
41
- logger.error({ err }, 'Function failed');
29
+ logger.error(err, 'Function failed');
42
30
 
43
31
  throw new Error('Function failed');
44
32
  }
45
- }),
46
- );
33
+ });
47
34
 
48
35
  export const createBatchSQSHandler =
49
36
  (
@@ -58,7 +45,7 @@ export const createBatchSQSHandler =
58
45
  await fn(record, ctx);
59
46
  return;
60
47
  } catch (err) {
61
- logger.error({ err }, 'Processing record failed');
48
+ logger.error(err, 'Processing record failed');
62
49
  return {
63
50
  itemIdentifier: record.messageId,
64
51
  };
@@ -1,6 +1,6 @@
1
1
  import { AsyncLocalStorage } from 'async_hooks';
2
2
 
3
- import createLogger, { createDestination } from '@seek/logger';
3
+ import { createDestination, createLogger } from '@seek/logger';
4
4
 
5
5
  import { config } from 'src/config.js';
6
6
 
@@ -16,7 +16,7 @@ export const lambdaContext = new AsyncLocalStorage<LambdaContext>();
16
16
  export const recordContext = new AsyncLocalStorage<RecordContext>();
17
17
 
18
18
  const { destination, stdoutMock } = createDestination({
19
- mock: config.environment === 'test' && {
19
+ mock: config.deployment === 'test' && {
20
20
  redact: ['awsRequestId'],
21
21
  },
22
22
  });
@@ -25,9 +25,15 @@ export { stdoutMock };
25
25
 
26
26
  export const logger = createLogger(
27
27
  {
28
- base: {
29
- environment: config.environment,
30
- version: config.version,
28
+ eeeoh: {
29
+ /**
30
+ * TODO: choose an appropriate Datadog log tier.
31
+ *
32
+ * https://github.com/seek-oss/logger/blob/master/docs/eeeoh.md#datadog-log-tiers
33
+ */
34
+ datadog: 'tin',
35
+ team: '<%- teamName %>',
36
+ use: 'environment',
31
37
  },
32
38
 
33
39
  level: config.logLevel,
@@ -37,10 +43,8 @@ export const logger = createLogger(
37
43
  ...recordContext.getStore(),
38
44
  }),
39
45
 
40
- name: config.name,
41
-
42
46
  transport:
43
- config.environment === 'local' ? { target: 'pino-pretty' } : undefined,
47
+ config.deployment === 'local' ? { target: 'pino-pretty' } : undefined,
44
48
  },
45
49
  destination,
46
50
  );
@@ -7,8 +7,5 @@ const prefix = `${config.name}.`;
7
7
  export const metricsClient = {
8
8
  distribution: (
9
9
  ...[name, ...rest]: Parameters<typeof sendDistributionMetric>
10
- ) =>
11
- config.metrics
12
- ? sendDistributionMetric(`${prefix}${name}`, ...rest)
13
- : undefined,
10
+ ) => sendDistributionMetric(`${prefix}${name}`, ...rest),
14
11
  };
@@ -18,7 +18,7 @@ jobs:
18
18
  timeout-minutes: 20
19
19
  steps:
20
20
  - name: Check out repo
21
- uses: actions/checkout@v4
21
+ uses: actions/checkout@v5
22
22
  with:
23
23
  fetch-depth: 0
24
24
 
@@ -16,7 +16,7 @@ jobs:
16
16
  timeout-minutes: 20
17
17
  steps:
18
18
  - name: Check out repo
19
- uses: actions/checkout@v4
19
+ uses: actions/checkout@v5
20
20
 
21
21
  - name: Set up Node.js
22
22
  uses: actions/setup-node@v4