the_mero
the_mero

Reputation: 171

error TS2339: Property 'BuildEnvironmentVariable' does not exist on type

I'm using CDK (Typescript) to build a CodePipeline. I'm trying to add an environment variable to a stage in the pipeline. Disclaimer: CDK and Typescript noob.

import codebuild = require('@aws-cdk/aws-codebuild');


        stageName: 'build',
          actions: [
            new codepipeline_actions.CodeBuildAction({
              actionName: 'my-build',
              project: myProject,
              input: source,
              environmentVariables: {
                "MY_VARIABLE": new codebuild.BuildEnvironmentVariable('my_value'),
              }
            }),
          ],
          

This results in the following error when I run the npm build:

error TS2339: Property 'BuildEnvironmentVariable' does not exist on type 'typeof import("/home/myuser/myproject/node_modules/@aws-cdk/aws-codebuild/lib/index

There's no other complaint.

I like to think I am making some kind of stupid error, but I don't see why codebuild.BuildEnvironmentVariable doesn't resolve. API documentation: https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-codepipeline-actions.CodeBuildActionProps.html

I have spent quite some time trying to find examples of anyone else using environment variables in a Typescript CodePipeline CDK recipe; no success.

Upvotes: 3

Views: 1807

Answers (1)

the_mero
the_mero

Reputation: 171

OK, it was a schoolboy error:

              environmentVariables: {
                "MY_VARIABLE": { value: 'my_value' },
              }

Upvotes: 5

Related Questions