aws / aws/aws-cdk

aws-appsync: Missing grant functions in IChannelNamespace

Open
#34,589 1 comment 1 reaction 0 assignees View on GitHub
@aws-cdk/aws-appsync feature-request p2
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### Describe the bug

Typescript definitions for `IChannelNamespace` is not exposing `grantPublish`, `grantSubscribe` and `grantPublishAndSubscribe` functions. This would be very useful when using `ChannelNamespace#fromChannelNamespaceArn`.

### Regression Issue

- [ ] Select this option if this issue appears to be a regression.

### Last Known Working CDK Library Version

_No response_

### Expected Behavior

I would expect to be able to grant publish/subscribe access to a lambda function when loading a channel namespace using the arn from a stack.

### Current Behavior

```typescript
const iChannelNamespace = ChannelNamespace.fromChannelNamespaceArn(this, 'ChannelNamespace', `my-arn`);
iChannelNamespace.grantPublish(myLambdaFunction);
```

Grant functions are not defined in the interface and compilation fails: `TS2339: Property grantPublish does not exist on type IChannelNamespace`

### Reproduction Steps

```typescript
const iChannelNamespace = ChannelNamespace.fromChannelNamespaceArn(this, 'ChannelNamespace', `my-arn`);
iChannelNamespace.grantPublish(myLambdaFunction);
```

### Possible Solution

_No response_

### Additional Information/Context

_No response_

### AWS CDK Library version (aws-cdk-lib)

2.199.0

### AWS CDK CLI version

2.1016.0

### Node.js Version

v22.12.0

### OS

mac

### Language

TypeScript

### Language Version

5.8.3

### Other information

_No response_

Contributor guide

Open the contributing guide

Research direction

Start at the IChannelNamespace interface and the ChannelNamespace#fromChannelNamespaceArn entry point mentioned in the issue, then compare the available grant methods with the concrete channel namespace implementation. The work is done when the three grant methods are exposed for imported channel namespaces and the TypeScript reproduction compiles successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
api, backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.