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

appsync resolver cannot set both maxBatchSize and PipelineConfig #27674

Open
hwangar opened this issue Oct 25, 2023 · 1 comment
Open

appsync resolver cannot set both maxBatchSize and PipelineConfig #27674

hwangar opened this issue Oct 25, 2023 · 1 comment
Labels
@aws-cdk/aws-appsync Related to AWS AppSync bug This issue is a bug. needs-cfn This issue is waiting on changes to CloudFormation before it can be addressed. p3

Comments

@hwangar
Copy link

hwangar commented Oct 25, 2023

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

@hwangar hwangar added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Oct 25, 2023
@github-actions github-actions bot added the @aws-cdk/aws-appsync Related to AWS AppSync label Oct 25, 2023
@peterwoodworth peterwoodworth changed the title appsync appsync resolver cannot set both maxBatchSize and PipelineConfig Oct 25, 2023
@peterwoodworth
Copy link
Contributor

If this is happening during deployment, that means CloudFormation is throwing the error here. I can't find any docs that say this should be limited, but assuming we're generating the template as expected, this would be an issue with CloudFormation's implementation. @indrora @khushail will one of you be able to follow up on this internally?

@peterwoodworth peterwoodworth added needs-cfn This issue is waiting on changes to CloudFormation before it can be addressed. p2 and removed needs-triage This issue or PR still needs to be triaged. labels Oct 25, 2023
@khushail khushail removed their assignment Jun 4, 2024
@pahud pahud added p3 and removed p2 labels Jun 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-appsync Related to AWS AppSync bug This issue is a bug. needs-cfn This issue is waiting on changes to CloudFormation before it can be addressed. p3
Projects
None yet
Development

No branches or pull requests

5 participants