-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't get port from RDS DatabaseCluster Endpoint #2711
Can't get port from RDS DatabaseCluster Endpoint #2711
Comments
|
Just confirmed. Still happening in v0.34 |
+1 for this, seeing the same behavior |
The port needs to be passed as a string to the `Endpoint` class otherwise the concatenation of address and port does not resolve correctly (forced string conversion of number token). Fixes aws#2711
The port needs to be passed as a string to the `Endpoint` class otherwise the concatenation of address and port does not resolve correctly (forced string conversion of number token). Fixes aws#2711
Convert port to a string token before using it in `socketAddress` otherwise the number token is converted to a string and cannot be resolved. Fixes aws#2711
Convert port to a string token before using it in `socketAddress` otherwise the number token is converted to a string and cannot be resolved. Fixes #2711
This should be fixed in the next release, as a temporary workaround in v0.34.0 you can do this to use the const socketAddress = `${db.clusterEndpoint.hostname}:${new cdk.Token(db.clusterEndpoint.port)}`; |
The problem is still present on 1.45.0 - I get port number |
This issue is still there in
|
@balupraveendatty maybe you're missing a call to const vpc = new ec2.Vpc(this, 'Vpc');
const db = new rds.DatabaseCluster(this, "Database", {
engine: rds.DatabaseClusterEngine.auroraPostgres({
version: rds.AuroraPostgresEngineVersion.VER_10_7,
}),
instanceProps: {
vpc,
},
});
new cdk.CfnOutput(this, 'Output', {
value: cdk.Token.asString(db.clusterEndpoint.port),
}); Produces: Outputs:
Output:
Value:
Fn::GetAtt:
- DatabaseB269D8BB
- Endpoint.Port |
Nice one, cheers @skinny85 |
Thanks @skinny85 , you saved me 🥰 |
Looks like this is still an issue. When I console.log the port: console.log('port', cluster.clusterEndpoint.port) I get:
|
Btw, I can fix it like this: Object.assign(cluster.clusterEndpoint, { port: 5432 }) |
@skinny85 But I don't have the option to wrap in |
OK... can you show the consuming code then? |
Right. Exactly like I said in #2711 (comment), the code should be: port: Token.toString(props.serverlessCluster.clusterEndpoint.port), , not: port: props.serverlessCluster.clusterEndpoint.port.toString(), |
not |
Describe the bug
I can't pass the RDS port from one stack to another.
I open a question on StackOverflow about it, but now I think it's actually a bug.
To Reproduce
The console output is:
Expected behavior
I need a way to determine the port.
Version:
The text was updated successfully, but these errors were encountered: