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

aws-codecommit: IRepository does not allow 'notify' triggers #29105

Open
SeriesOfUnlikelyExplanations opened this issue Feb 14, 2024 · 3 comments
Labels
@aws-cdk/aws-codecommit Related to AWS CodeCommit bug This issue is a bug. effort/medium Medium work item – several days of effort p2

Comments

@SeriesOfUnlikelyExplanations

Describe the bug

When I import a repository, I am unable to use the repo.notify event. It does work when I create a new repo.

This fails:

const repo = Repository.fromRepositoryName(this, 'repoName', repoName)

repo.notify(handler.functionArn, {
  branches: ['live'],
  events: [RepositoryEventTrigger.UPDATE_REF],
  name: 'push',
});

This works:

const repo = new Repository(this, repoName,{
  repositoryName: repoName,
});

repo.notify(handler.functionArn, {
  branches: ['live'],
  events: [RepositoryEventTrigger.UPDATE_REF],
  name: 'push',
});

Expected Behavior

I expect this to not produce an error:

const repo = Repository.fromRepositoryName(this, 'repoName', repoName)

repo.notify(handler.functionArn, {
  branches: ['live'],
  events: [RepositoryEventTrigger.UPDATE_REF],
  name: 'push',
});

Current Behavior

I get the following error:

Property 'notify' does not exist on type 'IRepository'. Did you mean 'notifyOn'?

Reproduction Steps

const repo = Repository.fromRepositoryName(this, 'repoName', repoName)

repo.notify(handler.functionArn, {
  branches: ['live'],
  events: [RepositoryEventTrigger.UPDATE_REF],
  name: 'push',
});

TSError: ⨯ Unable to compile TypeScript:
codePipelineStack.ts:65:12 - error TS2551: Property 'notify' does not exist on type 'IRepository'. Did you mean 'notifyOn'?

65 repo.notify(handler.functionArn, {
~~~~~~

../node_modules/aws-cdk-lib/aws-codecommit/lib/repository.d.ts:116:5
116 notifyOn(id: string, target: notifications.INotificationRuleTarget, options: RepositoryNotifyOnOptions): notifications.INotificationRule;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'notifyOn' is declared here.

Possible Solution

Add the notify type to the IRepository class in addition to the Repository class.

Additional Information/Context

No response

CDK CLI Version

2.127.0

Framework Version

No response

Node.js Version

v20.10.0

OS

ubuntu

Language

TypeScript

Language Version

3.9.7

Other information

No response

@SeriesOfUnlikelyExplanations SeriesOfUnlikelyExplanations added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Feb 14, 2024
@github-actions github-actions bot added the @aws-cdk/aws-codecommit Related to AWS CodeCommit label Feb 14, 2024
@pahud
Copy link
Contributor

pahud commented Feb 14, 2024

Yes at this moment, notify is available only for class Repository, which represents a new one rather than an imported one(IRepository).

@pahud pahud added p2 effort/medium Medium work item – several days of effort and removed needs-triage This issue or PR still needs to be triaged. labels Feb 14, 2024
@SeriesOfUnlikelyExplanations
Copy link
Author

Was that by design or is it a bug? If by design, why?

@adamjkeller
Copy link
Contributor

We should close this issue as CodeCommit is no longer taking new customers and eventually will be deprecated. See here: https://aws.amazon.com/blogs/devops/how-to-migrate-your-aws-codecommit-repository-to-another-git-provider/

@pahud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-codecommit Related to AWS CodeCommit bug This issue is a bug. effort/medium Medium work item – several days of effort p2
Projects
None yet
Development

No branches or pull requests

3 participants