@friggframework/devtools 2.0.0--canary.622.8425dec.0 → 2.0.0--canary.622.44c5bcb.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.
@@ -31,7 +31,19 @@ const OTEL_PASSTHROUGH_VARS = [
31
31
  function addTelemetryEnvPassthrough(appDefinition, envVars) {
32
32
  const exporterType = appDefinition?.telemetry?.exporter?.type;
33
33
  if (!OTLP_EXPORTER_TYPES.has(exporterType)) return;
34
+
35
+ // A passthrough var that is also marked for SSM offload must NOT be baked
36
+ // as a direct `${env:KEY, ''}` Lambda var: the deploy shell has no such var
37
+ // (it lives only in Parameter Store), so it resolves to '' at package time,
38
+ // and at runtime '' !== undefined blocks the SSM loader from ever populating
39
+ // it. Leave it out here so it lives only in FRIGG_SSM_OFFLOADED_KEYS. When
40
+ // offload is inactive (local mode / ssm disabled) it still gets the
41
+ // passthrough, matching the local-fallback contract.
42
+ const offloadedKeys = isSsmOffloadActive(appDefinition)
43
+ ? new Set(getOffloadedKeys(appDefinition))
44
+ : null;
34
45
  for (const key of OTEL_PASSTHROUGH_VARS) {
46
+ if (offloadedKeys?.has(key)) continue;
35
47
  envVars[key] = `\${env:${key}, ''}`;
36
48
  }
37
49
  }
@@ -249,6 +249,106 @@ describe('Environment Builder', () => {
249
249
  });
250
250
  });
251
251
 
252
+ describe('telemetry env passthrough + SSM offload interaction', () => {
253
+ const originalSkipDiscovery = process.env.FRIGG_SKIP_AWS_DISCOVERY;
254
+
255
+ afterEach(() => {
256
+ if (originalSkipDiscovery === undefined) {
257
+ delete process.env.FRIGG_SKIP_AWS_DISCOVERY;
258
+ } else {
259
+ process.env.FRIGG_SKIP_AWS_DISCOVERY = originalSkipDiscovery;
260
+ }
261
+ });
262
+
263
+ it("does not bake an OTEL passthrough var that is marked 'ssm' when offload is active", () => {
264
+ delete process.env.FRIGG_SKIP_AWS_DISCOVERY;
265
+ const appDefinition = {
266
+ telemetry: { exporter: { type: 'datadog' } },
267
+ ssm: { enable: true },
268
+ environment: {
269
+ OTEL_EXPORTER_OTLP_ENDPOINT: 'ssm',
270
+ OTEL_EXPORTER_OTLP_HEADERS: 'ssm',
271
+ },
272
+ };
273
+
274
+ const result = getAppEnvironmentVars(appDefinition);
275
+
276
+ expect(result.OTEL_EXPORTER_OTLP_ENDPOINT).toBeUndefined();
277
+ expect(result.OTEL_EXPORTER_OTLP_HEADERS).toBeUndefined();
278
+ });
279
+
280
+ it("keeps the direct passthrough for an OTEL var not marked 'ssm' while offloading its sibling", () => {
281
+ delete process.env.FRIGG_SKIP_AWS_DISCOVERY;
282
+ const appDefinition = {
283
+ telemetry: { exporter: { type: 'otlp' } },
284
+ ssm: { enable: true },
285
+ environment: {
286
+ OTEL_EXPORTER_OTLP_ENDPOINT: 'ssm',
287
+ },
288
+ };
289
+
290
+ const result = getAppEnvironmentVars(appDefinition);
291
+
292
+ expect(result.OTEL_EXPORTER_OTLP_ENDPOINT).toBeUndefined();
293
+ expect(result.OTEL_EXPORTER_OTLP_HEADERS).toBe(
294
+ "${env:OTEL_EXPORTER_OTLP_HEADERS, ''}"
295
+ );
296
+ });
297
+
298
+ it("falls back to the env passthrough for an 'ssm'-marked OTEL var in local mode", () => {
299
+ process.env.FRIGG_SKIP_AWS_DISCOVERY = 'true';
300
+ const appDefinition = {
301
+ telemetry: { exporter: { type: 'datadog' } },
302
+ ssm: { enable: true },
303
+ environment: {
304
+ OTEL_EXPORTER_OTLP_ENDPOINT: 'ssm',
305
+ },
306
+ };
307
+
308
+ const result = getAppEnvironmentVars(appDefinition);
309
+
310
+ expect(result.OTEL_EXPORTER_OTLP_ENDPOINT).toBe(
311
+ "${env:OTEL_EXPORTER_OTLP_ENDPOINT, ''}"
312
+ );
313
+ });
314
+
315
+ it("leaves a 'true'-marked OTEL var as a direct passthrough even when offload is active for another key", () => {
316
+ delete process.env.FRIGG_SKIP_AWS_DISCOVERY;
317
+ const appDefinition = {
318
+ telemetry: { exporter: { type: 'datadog' } },
319
+ ssm: { enable: true },
320
+ environment: {
321
+ OTEL_EXPORTER_OTLP_ENDPOINT: true,
322
+ SOME_OFFLOADED_SECRET: 'ssm',
323
+ },
324
+ };
325
+
326
+ const result = getAppEnvironmentVars(appDefinition);
327
+
328
+ expect(result.OTEL_EXPORTER_OTLP_ENDPOINT).toBe(
329
+ "${env:OTEL_EXPORTER_OTLP_ENDPOINT, ''}"
330
+ );
331
+ expect(result.SOME_OFFLOADED_SECRET).toBeUndefined();
332
+ });
333
+
334
+ it('does not bake an OTEL passthrough var offloaded only via ssm.parameters', () => {
335
+ delete process.env.FRIGG_SKIP_AWS_DISCOVERY;
336
+ const appDefinition = {
337
+ telemetry: { exporter: { type: 'datadog' } },
338
+ ssm: {
339
+ enable: true,
340
+ parameters: {
341
+ OTEL_EXPORTER_OTLP_ENDPOINT: { type: 'SecureString' },
342
+ },
343
+ },
344
+ };
345
+
346
+ const result = getAppEnvironmentVars(appDefinition);
347
+
348
+ expect(result.OTEL_EXPORTER_OTLP_ENDPOINT).toBeUndefined();
349
+ });
350
+ });
351
+
252
352
  describe('buildEnvironment()', () => {
253
353
  it('should combine app vars with standard Frigg variables', () => {
254
354
  const appEnvironmentVars = {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@friggframework/devtools",
3
3
  "prettier": "@friggframework/prettier-config",
4
- "version": "2.0.0--canary.622.8425dec.0",
4
+ "version": "2.0.0--canary.622.44c5bcb.0",
5
5
  "bin": {
6
6
  "frigg": "./frigg-cli/index.js"
7
7
  },
@@ -26,9 +26,9 @@
26
26
  "@babel/eslint-parser": "^7.18.9",
27
27
  "@babel/parser": "^7.25.3",
28
28
  "@babel/traverse": "^7.25.3",
29
- "@friggframework/core": "2.0.0--canary.622.8425dec.0",
30
- "@friggframework/schemas": "2.0.0--canary.622.8425dec.0",
31
- "@friggframework/test": "2.0.0--canary.622.8425dec.0",
29
+ "@friggframework/core": "2.0.0--canary.622.44c5bcb.0",
30
+ "@friggframework/schemas": "2.0.0--canary.622.44c5bcb.0",
31
+ "@friggframework/test": "2.0.0--canary.622.44c5bcb.0",
32
32
  "@hapi/boom": "^10.0.1",
33
33
  "@inquirer/prompts": "^5.3.8",
34
34
  "axios": "^1.18.0",
@@ -56,8 +56,8 @@
56
56
  "validate-npm-package-name": "^5.0.0"
57
57
  },
58
58
  "devDependencies": {
59
- "@friggframework/eslint-config": "2.0.0--canary.622.8425dec.0",
60
- "@friggframework/prettier-config": "2.0.0--canary.622.8425dec.0",
59
+ "@friggframework/eslint-config": "2.0.0--canary.622.44c5bcb.0",
60
+ "@friggframework/prettier-config": "2.0.0--canary.622.44c5bcb.0",
61
61
  "aws-sdk-client-mock": "^4.1.0",
62
62
  "aws-sdk-client-mock-jest": "^4.1.0",
63
63
  "jest": "^30.1.3",
@@ -89,5 +89,5 @@
89
89
  "publishConfig": {
90
90
  "access": "public"
91
91
  },
92
- "gitHead": "8425dec6d3f2c09f7906f1e36c6856f63e1e69f9"
92
+ "gitHead": "44c5bcb5ac98478fe902170b7e5c0cf8c0315ddf"
93
93
  }