Skip to content
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

fix(cli): breaks without globally installed aws-cdk-lib #3398

Merged
merged 1 commit into from
Jul 12, 2023

Conversation

Chriscbr
Copy link
Contributor

Fixes #3396

This "instanceof" check is causing problems since it results in several other modules to get imported, including those that require aws-cdk-lib to be installed -- even if you're not compiling to the awscdk target. Removing this code path as a hotfix.

Checklist

  • Title matches Winglang's style guide
  • Description explains motivation and solution
  • Tests added (always)
  • Docs updated (only required for features)
  • Added pr/e2e-full label if this feature requires end-to-end testing

By submitting this pull request, I confirm that my contribution is made under the terms of the Monada Contribution License.

Copy link
Contributor

@hasanaburayyan hasanaburayyan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any idea why the above instanceof check (for TfAwsFunction) does not cause a similar issue?

@MarkMcCulloh
Copy link
Contributor

Any idea why the above instanceof check (for TfAwsFunction) does not cause a similar issue?

cdktf is a bundled dependency of @winglang/sdk so it's included in the end package.
aws-cdk-lib is also supposed to be bundled, but we intentionally remove it from the final package (because it's took big iirc)

@mergify
Copy link
Contributor

mergify bot commented Jul 12, 2023

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot merged commit 0e7781a into main Jul 12, 2023
@mergify mergify bot deleted the rybickic/fix-aws-cdk-lib branch July 12, 2023 22:00
@monadabot
Copy link
Contributor

Congrats! 🚀 This was released in Wing 0.24.16.

@@ -35,10 +34,6 @@ export class Function {
return host;
}

if (host instanceof AwsCdkFunction) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think duck-typing much be a better approach here.

Basically check that the host implements IAwsFunction's methods.

@mergify
Copy link
Contributor

mergify bot commented Jul 16, 2023

⚠️ Code freeze in effect! ⚠️

The main branch is currently frozen. Only critical fixes or documentation updates will be merged.
Please submit your pull request against the dev branch instead.

mergify bot pushed a commit that referenced this pull request Aug 11, 2023
Following @eladb's recommendation in PR #3398, I removed the import of `target-awscdk` and `target-tf-aws`, and checked if the `host` implements the methods of the `IAwsFunction` interface. This way, the error that was occurring due to not having `aws-cdk-lib` globally installed no longer happens.

## Checklist

- [x] Title matches [Winglang's style guide](https://www.winglang.io/contributing/start-here/pull_requests#how-are-pull-request-titles-formatted)
- [x] Description explains motivation and solution
- [x] Tests added (always)
- [ ] Docs updated (only required for features)
- [ ] Added `pr/e2e-full` label if this feature requires end-to-end testing

*By submitting this pull request, I confirm that my contribution is made under the terms of the [Wing Cloud Contribution License](https://github.com/winglang/wing/blob/main/CONTRIBUTION_LICENSE.md)*.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CLI breaks without globally install aws-cdk-lib
5 participants