question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

aws-codepipeline-actions: SecretValue is not assignable to type

See original GitHub issue

Since 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:closed
  • Created 3 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
fire015commented, Jan 12, 2021

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.

1reaction
skinny85commented, Jan 12, 2021

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 running npm install without a package-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:

  1. Remove the package-lock.json file, and run npm install again.
  2. Use the npm update command to update the CDK packages you are depending on in your package-lock.json file.

Thanks, Adam

Read more comments on GitHub >

github_iconTop Results From Across the Web

SecretValue - AWS Documentation - Amazon.com
No information is available for this page.
Read more >
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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found