diff --git a/packages/graphql-mesh-server/lib/fargate.ts b/packages/graphql-mesh-server/lib/fargate.ts index 7a36cfb6..10081be1 100644 --- a/packages/graphql-mesh-server/lib/fargate.ts +++ b/packages/graphql-mesh-server/lib/fargate.ts @@ -1,5 +1,5 @@ import { Construct } from 'constructs'; -import { Duration } from 'aws-cdk-lib'; +import { Duration, Token } from 'aws-cdk-lib'; import { RemovalPolicy } from 'aws-cdk-lib'; import * as acm from 'aws-cdk-lib/aws-certificatemanager'; import * as ecs from 'aws-cdk-lib/aws-ecs'; @@ -129,11 +129,11 @@ export class MeshService extends Construct { if (props.redis) { props.redis.securityGroup.addIngressRule( securityGroup, - Port.tcp(Number(props.redis.connectionPort)) + Port.tcp(props.redis.connectionPort) ); environment['REDIS_ENDPOINT'] = props.redis.connectionEndPoint; - environment['REDIS_PORT'] = props.redis.connectionPort; + environment['REDIS_PORT'] = props.redis.connectionPort.toString(); } // Construct secrets from provided ssm values diff --git a/packages/graphql-mesh-server/lib/redis-construct.ts b/packages/graphql-mesh-server/lib/redis-construct.ts index a0319f43..f88526b0 100644 --- a/packages/graphql-mesh-server/lib/redis-construct.ts +++ b/packages/graphql-mesh-server/lib/redis-construct.ts @@ -4,7 +4,7 @@ import { CfnSubnetGroup, CfnParameterGroup, } from 'aws-cdk-lib/aws-elasticache'; -import { CfnOutput } from 'aws-cdk-lib'; +import { CfnOutput, Reference, Token } from 'aws-cdk-lib'; import { Construct } from 'constructs'; export interface RedisServiceProps { @@ -83,14 +83,10 @@ export class RedisService extends Construct { } public get connectionEndPoint(): string { - return this.cacheCluster - .getAtt('RedisEndpoint.Address') - .toString(); + return Token.asString(this.cacheCluster.getAtt('RedisEndpoint.Address')) } - public get connectionPort(): string { - return this.cacheCluster - .getAtt('RedisEndpoint.Port') - .toString(); + public get connectionPort(): number { + return Token.asNumber(this.cacheCluster.getAtt('RedisEndpoint.Port')); } }