app.node.tryGetContext #17888
-
Hello, I have been attempting to move a project to v2 and the aws-cdk-lib package. unfortunately I've hit an issue almost immediately whereby node is no longer recognised as a property of cdk.App, this has the knock-on effect that I cannot use tryGetContext. `#!/usr/bin/env node const app = new cdk.App(); I know that the cdk-examples repository was recently updated to use v2 and they too contain tryGetContext, so, it should still work? I'm not sure what I am missing. many thanks |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 1 reply
-
for anyone who might encounter the same issue, I created a new blank folder with a v2 sample app ( cdk init app --language=typescript) and there must be some conflicts in the original project as this new one works as expected. I can only assume that the suggestion in the aws-cdk-lib readme that all we need to do is "declare aws-cdk-lib and constructs packages....then change imports" might not be quite enough, either that or I completely missed some other upgrade instructions somewhere... |
Beta Was this translation helpful? Give feedback.
-
Hello @greensmith, while I typically import without the core subfolder, as in: Let me know if it helps 👍 |
Beta Was this translation helpful? Give feedback.
-
adding https://www.npmjs.com/package/constructs to my application resolved this. |
Beta Was this translation helpful? Give feedback.
-
Hello! Reopening this discussion to make it searchable. |
Beta Was this translation helpful? Give feedback.
adding https://www.npmjs.com/package/constructs to my application resolved this.
npm i constructs