aws-codepipeline-actions: SecretValue is not assignable to type
See original GitHub issueSince 1.83.0 the oauthToken
field in codepipeline_actions.GitHubSourceAction
cannot be assigned the secret value as per the docs and examples.
Reproduction Steps
new codepipeline_actions.GitHubSourceAction({
actionName: "...",
owner: "...",
repo: "...",
oauthToken: cdk.SecretValue.secretsManager("my-github-token"),
output: sourceOutput,
branch: "...",
});
What did you expect to happen?
Oauth token is assigned correctly
What actually happened?
⨯ Unable to compile TypeScript:
lib/pipeline-stack.ts:54:7 - error TS2322: Type 'import("/opt/code/aws/pipeline/node_modules/@aws-cdk/core/lib/secret-value").SecretValue' is not assignable to type 'import("/opt/code/aws/pipeline/node_modules/@aws-cdk/aws-cloudwatch/node_modules/@aws-cdk/core/lib/secret-value").SecretValue'.
Types have separate declarations of a private property 'value'.
54 oauthToken: cdk.SecretValue.secretsManager('my-github-token'),
~~~~~~~~~~
node_modules/@aws-cdk/aws-codepipeline-actions/lib/github/source-action.d.ts:117:14
117 readonly oauthToken: SecretValue;
~~~~~~~~~~
The expected type comes from property 'oauthToken' which is declared here on type 'GitHubSourceActionProps'
Environment
- CDK CLI Version : 1.83.0
- Framework Version: 1.83.0
- Node.js Version: 10.22.1
- OS : Ubuntu
- Language (Version): TypeScript
Other
It looks like there are multiple definitions of SecretValue
one within aws-cloudwatch
and one within cdk-core
.
This is 🐛 Bug Report
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Typescript error: It is not assignable to parameter of type ...
I have a question, where I have same library but they are referred as not same type. Compilation Error: Argument of type 'import("/Users/Smit/ ......
Read more >awscodepipelineactions - Go Packages
AWS CodePipeline Actions. This package contains Actions that can be used in a CodePipeline. import codepipeline "github.com/aws/aws-cdk-go/awscdk" import ...
Read more >awslabs/aws-cdk - Gitter
Hello, would anyone know if there is a problem with this SecretValue. ... Argument of type 'this' is not assignable to parameter of...
Read more >Pattern: Secure AWS secret handling with TypeScript CDK
... Via CloudFormaton - set the secret value using CloudFormation; this is not recommended since the secrets end up in plain text and...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I figured out what the problem was!
In my
package.json
file the@aws-cdk/core
dependency was missing the ^ so it was fixed to 1.82 whereas the other packages were correctly installing 1.83.Thanks for your help.
I don’t think you’ll get the same error if you remove your
package-lock.json
file. That’s because you’re using^
to specify your dependencies, which means runningnpm install
without apackage-lock.json
at different times will produce different results (based on what version of the CDK is currently the latest).If you want to unblock yourself, I can see two easy ways:
package-lock.json
file, and runnpm install
again.npm update
command to update the CDK packages you are depending on in yourpackage-lock.json
file.Thanks, Adam