aws / aws/aws-cdk

appsync: resolver should be in the datasource scope, not in the api scope

Open
#24,620 3 comments 0 reactions 0 assignees View on GitHub
@aws-cdk/aws-appsync bug p3
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### Describe the bug

When creating nested stacks with AppSync resolvers, they are actually attached to the stack where the `api` is defined instead of the `datasource`.

https://github.com/aws/aws-cdk/blob/1105514fc88ae4637a5d187a48ff1a37a4932579/packages/%40aws-cdk/aws-appsync/lib/data-source.ts#L136

### Expected Behavior

Resolvers should have their datasource as parent resource.

### Current Behavior

Resolvers have the api as parent resource.

### Reproduction Steps

Create nested stacks with datasource and resolvers attached to an api defined in the parent stack.

### Possible Solution

Construct a `Resolver` directly, not the `createResolver` function.

### Additional Information/Context

_No response_

### CDK CLI Version

2.68.1

### Framework Version

_No response_

### Node.js Version

16

### OS

macOS

### Language

Typescript

### Language Version

_No response_

### Other information

_No response_

Contributor guide

Open the contributing guide

Research direction

Inspect packages/@aws-cdk/aws-appsync/lib/data-source.ts around line 136, then reproduce the nested-stack setup described in the issue with the API in the parent stack and the datasource and resolver in nested stacks. Done means the resolver is constructed with the datasource as its parent resource rather than being attached to the API scope.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
cloud, infrastructure
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.