mongodb / awscdk-resources-mongodbatlas

MongoDB Atlas AWS CDK Resources
Apache License 2.0
33 stars 15 forks source link

[Bug]: Version 3.5.2 is NOT backwards compatible with version 3.5.1 and below #278

Closed lockenj closed 1 month ago

lockenj commented 1 month ago

Is there an existing issue for this?

CDK package version

v3.5.2

CFN Resource version

N/A

CFN Resource Region

N/A

Current Behavior

In version v3.5.1 the below snippet returns the standardSrv connection string.

this.#_atlasCluster.connectionStrings.standardSrv

Now in v3.5.2 I get error:

TypeError: Cannot read properties of undefined (reading 'standardSrv')

AWS CDK code to reproduce the issue

this.#_atlasCluster.connectionStrings.standardSrv

Steps To Reproduce

This will fail using cdk Synth

cdk synth

TypeError: Cannot read properties of undefined (reading 'standardSrv')
      at new MongoAtlasConstruct (file:///home/runner/work/frank/frank/packages/infra-libs/core-environment/lib/MongoAtlasConstruct.mjs:235:107)
      at new TestStack (file:///home/runner/work/frank/frank/packages/infra-libs/core-environment/test/unit/mongo.test.mjs:15:44)
      at Context.<anonymous> (file:///home/runner/work/frank/frank/packages/infra-libs/core-environment/test/unit/mongo.test.mjs:24:23)
      at process.processImmediate (node:internal/timers:478:21)


### Code of Conduct

- [X] I agree to follow this project's Code of Conduct
github-actions[bot] commented 1 month ago

Thanks for opening this issue! Please make sure to provide the following information to help us reproduce the issue:

Thanks for opening this issue. The ticket CLOUDP-248553 was created for internal tracking.

lockenj commented 1 month ago

See PR 277

lantoli commented 1 month ago

sorry @lockenj for the inconvenience.

that property shouldn't have existed in the first place. It was manually added so it was not synced with underlaying CFN resource. This CDK L1 resource must be generated automatically.

If you need to access those properties, you can do things like:

this.#_atlasCluster.getAtt("ConnectionStrings.StandardSrv")

you can take this PR 277 code change as a reference.

thanks

lantoli commented 1 month ago

@lockenj @romulus-ai thanks for your understanding, I'm happy that the proposed solution works for you as in the PR comments https://github.com/mongodb/awscdk-resources-mongodbatlas/pull/277.

closing this issue but don't hesitate to ask any other question you have.