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

CDK v2 seems to have changed plugin exports #37

Open
Purii opened this issue Sep 7, 2021 · 1 comment · Fixed by werty1st/cdk-multi-profile-plugin#1
Open

CDK v2 seems to have changed plugin exports #37

Purii opened this issue Sep 7, 2021 · 1 comment · Fixed by werty1st/cdk-multi-profile-plugin#1

Comments

@Purii
Copy link

Purii commented Sep 7, 2021

Thanks for that awesome plugin!

Unfortunately it doesn't seem to work anymore with recent versions of CDK v2 RC (at least 2.0.0-rc.20).
It seems like some exports aren't available anymore.
After changing some imports the plugin works again.

Error:

Unable to load cdk-multi-profile-plugin: Error: Cannot find module 'aws-cdk'
Require stack:
- /PATHTOREPO/node_modules/cdk-multi-profile-plugin/lib/ini-file-credential-provider-source.js
- /PATHTOREPO/node_modules/cdk-multi-profile-plugin/lib/multi-profile-plugin.js
- /PATHTOREPO/node_modules/cdk-multi-profile-plugin/lib/index.js
- /PATHTOREPO/node_modules/aws-cdk/lib/plugin.js
- /PATHTOREPO/node_modules/aws-cdk/lib/api/aws-auth/credential-plugins.js
- /PATHTOREPO/node_modules/aws-cdk/lib/api/aws-auth/sdk-provider.js
- /PATHTOREPO/node_modules/aws-cdk/lib/api/aws-auth/index.js
- /PATHTOREPO/node_modules/aws-cdk/bin/cdk.js
- /PATHTOREPO/node_modules/aws-cdk/bin/cdk
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:94:18)
    at Object.<anonymous> (/PATHTOREPO/node_modules/cdk-multi-profile-plugin/src/ini-file-credential-provider-source.ts:4:1)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
Unable to load plug-in: cdk-multi-profile-plugin

Working Fix:

// /cdk-multi-profile-plugin/ini-file-credential-provider-source.ts:4
import { CredentialProviderSource, Mode } from "aws-cdk/lib/api/aws-auth/credentials";

// /cdk-multi-profile-plugin/multi-profile-plugin
import { Plugin, PluginHost } from "aws-cdk/lib/plugin";

Are you aware of that? I didn't dig too deep into the CDKv2 Source and not sure if there are any official API Changes for Plugins. If it's fine for you to import the exports directly from the specific files I can create a PR. But an official API would be more solid.

wiget added a commit to wiget/cdk-multi-profile-plugin that referenced this issue Dec 3, 2021
wiget added a commit to wiget/cdk-multi-profile-plugin that referenced this issue Dec 3, 2021
wiget added a commit to wiget/cdk-multi-profile-plugin that referenced this issue Dec 3, 2021
@wiget
Copy link
Contributor

wiget commented Dec 3, 2021

Hello @hupe1980

I've made PR based on @Purii findings. I'm not TypeScript master so please check if it's OK.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants