aws / aws/aws-cdk

appsync resolver cannot set both maxBatchSize and PipelineConfig

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

Description

### Describe the bug

UPDATE_ROLLBACK_COMPLETE: Pipeline JS resolvers cannot have a maxBatchSize when using maxBatchSize with a pipeline, sth totally ok with aws console

### Expected Behavior

Allow maxBatchSize with a pipeline

### Current Behavior

Currently I have to patch after deployment

### Reproduction Steps

Sample legit use case:

resolver code: BatchInvoke to a lambda

```
function request(context) {
return {
operation: "BatchInvoke",
payload: {
context,
selectionSetList: context.info.selectionSetList
}
};
}
function response(ctx) {
const { error, result } = ctx;
if (result.error) {
const { message, type, data } = result;
util.error(message, type, data);
}
if (error)
util.appendError(error.message, error.type);
return result;
}
export {
request,
response
};
```

at pipeline I have the batch processor lambda as per doc

cdk code:

```
private createJsResolver(appSync: appsync.GraphqlApi, dataSource: appsync.BaseDataSource, typeName: string, fieldName: string, resolverNames: string[]) {
const fns = resolverNames.map(
resolver =>
new appsync.AppsyncFunction(this, `fn-${typeName}-${fieldName}-${resolver}`, {
name: `${typeName}_${fieldName}_${resolver}`,
api: appSync,
dataSource,
code: this.bundleAppSyncResolver(path.join(__dirname, `../../src/main/infrastructure/resolvers/${resolver}.ts`)),
runtime: appsync.FunctionRuntime.JS_1_0_0,
}),
);
appSync.createResolver(`res-${typeName}-${fieldName}`, {
typeName,
fieldName,
runtime: appsync.FunctionRuntime.JS_1_0_0,
code: this.defaultPipelineCode,
pipelineConfig: fns,
// TODO check later "Pipeline resolvers cannot have a maxBatchSize."
// maxBatchSize: resolverNames.includes('_lambdaBatchInvoke') ? 200 : undefined,
});
}
```

when deploying, error shows up

### Possible Solution

_No response_

### Additional Information/Context

_No response_

### CDK CLI Version

2.102.0 (build 2abc59a)

### Framework Version

_No response_

### Node.js Version

v18.13.0

### OS

Macos 12.6.8

### Language

TypeScript

### Language Version

Typescript 4.9.5

### Other information

x-prod failed: Error: The stack named x-prod failed to deploy: UPDATE_ROLLBACK_COMPLETE: Pipeline resolvers cannot have a maxBatchSize.
at FullCloudFormationDeployment.monitorDeployment (/Users/hwangar/Projects/backend/node_modules/aws-cdk/lib/index.js:467:10232)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Object.deployStack2 [as deployStack] (/Users/hwangar/Projects/backend/node_modules/aws-cdk/lib/index.js:470:180228)
at async /Users/hwangar/Projects/backend/node_modules/aws-cdk/lib/index.js:470:163476

Contributor guide

Open the contributing guide

Research direction

Start at the AppSync createResolver entry point and inspect how maxBatchSize and pipelineConfig are synthesized for the supplied TypeScript example. Reproduce the CloudFormation deployment error, then verify that a resolver using both settings is accepted without requiring a post-deployment patch.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
cloud, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.