Skip to content

appsync resolver cannot set both maxBatchSize and PipelineConfig #27674

Open
@hwangar

Description

@hwangar

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/aws-appsyncRelated to AWS AppSyncbugThis issue is a bug.needs-cfnThis issue is waiting on changes to CloudFormation before it can be addressed.p3

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions