diff --git a/packages/aws-cdk-lib/aws-synthetics/lib/canary.ts b/packages/aws-cdk-lib/aws-synthetics/lib/canary.ts index a3d3b38d78cad..87417055c0cf0 100644 --- a/packages/aws-cdk-lib/aws-synthetics/lib/canary.ts +++ b/packages/aws-cdk-lib/aws-synthetics/lib/canary.ts @@ -1,7 +1,7 @@ import * as crypto from 'crypto'; import { Construct } from 'constructs'; import { Code } from './code'; -import { Runtime } from './runtime'; +import { Runtime, RuntimeFamily } from './runtime'; import { Schedule } from './schedule'; import { CloudWatchSyntheticsMetrics } from './synthetics-canned-metrics.generated'; import { CfnCanary } from './synthetics.generated'; @@ -552,12 +552,8 @@ export class Canary extends cdk.Resource implements ec2.IConnectable { !props.timeout) { return undefined; } - const activeTracingNotSupportedRuntime = [ - Runtime.SYNTHETICS_PYTHON_SELENIUM_2_1, - Runtime.SYNTHETICS_PYTHON_SELENIUM_3_0, - ]; - if (props.activeTracing && activeTracingNotSupportedRuntime.includes(props.runtime)) { + if (props.activeTracing && !cdk.Token.isUnresolved(props.runtime.family) && props.runtime.family !== RuntimeFamily.NODEJS) { throw new Error('You can enable active tracing only for canaries that use version `syn-nodejs-2.0` or later for their canary runtime.'); } diff --git a/packages/aws-cdk-lib/aws-synthetics/test/canary.test.ts b/packages/aws-cdk-lib/aws-synthetics/test/canary.test.ts index 757b02f2d7795..5d70ab0c3a8d4 100644 --- a/packages/aws-cdk-lib/aws-synthetics/test/canary.test.ts +++ b/packages/aws-cdk-lib/aws-synthetics/test/canary.test.ts @@ -272,7 +272,7 @@ test('throws when activeTracing is enabled with an unsupported runtime', () => { runtime: synthetics.Runtime.SYNTHETICS_PYTHON_SELENIUM_2_1, activeTracing: true, })) - .toThrow('You can enable active tracing only for canaries that use version syn-nodejs-2.0 or later for their canary runtime.'); + .toThrow('You can enable active tracing only for canaries that use version `syn-nodejs-2.0` or later for their canary runtime.'); }); test('environment variables can be specified', () => {