amplify-cli: Upgraded from cli v3.9 to v3.17 - get error on push: "Invalid request template given, must be less than 64kb in size"

Describe the bug I upgraded the cli from v3.9 to v3.17 then did an amplify push. The push is failing with:

UPDATE_FAILED Update<redact>RequestResolver AWS::AppSync::Resolver Wed Nov 06 2019 14:36:46 GMT-0700 (Mountain Standard Time) Invalid request template given, must be less than 64kb in size. (Service: AWSAppSync; Status Code: 400; Error Code: BadRequestException; Request ID: d2eec6ea-649e-4dea-b188-d4464fd52e1c)

Amplify CLI Version v3.17

Desktop (please complete the following information):

  • OS: Mac
  • Node Version. 10.9

Additional context Add any other context about the problem here.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 3
  • Comments: 39 (8 by maintainers)

Most upvoted comments

This issue should be reopened. This is a major flaw. We are building a healthcare platform that has many fields which require different authorization levels. We can’t compromise security because there is a 64kb file size limit. AWS has to offer a larger size even if it requires to be on a paid plan.

This issue has been automatically closed because of inactivity. Please open a new issue if you are still encountering problems.

But you may be able to open a ticket with the AppSync team and ask them for a code size limit increase, not sure if that’s currently a soft or hard limit.

fyi I did contact AWS Support and they are not able to change these limits at this time. So the solution is to reduce the number of field-level auths until amplify cli comes up with reduced code to enforce field auths.

Hello everyone, With the new GraphQL Transformer v2 we’ve introduced the use of pipeline resolvers, which now splits logic into multiple VTL resolvers rather than one. On replication with a model containing over 30 fields with field level @auth rules we observed no VTL template exceeded 5 KB.

For more information please see the following documentation.

Closing issue, if you are experiencing continued issues, please do reply on this thread with an example schema.

Still an issue I believe.

+1 Please, I pay it without problem, just give us a solution, modifying the Graphql model is not an option. Thanks in Advance!

@RossWilliams Yes, this way is a little hack, but can reduce comment lines in resolver templates.

https://github.com/aws-amplify/amplify-cli/blob/master/packages/graphql-mapping-template/src/print.ts#L138

Changes:

function printComment(node: CommentNode, indent: string = ''): string {
  return '';
}

Note: Don’t forget to compile TypeScript to JavaScript.

Any updates? I got the same problem…

+1 Same I have need to implement field auth rules as well. My next approach may be using a lambda resolver.

Yikes. Never got a resolution to this?

Thank you @hisham for the update! Hmm, the solution AWS offers is hard to do, so I will try override a resolver to make small and optimize…

@hisham those limits are (presumably) b/c AppSync users don’t pay for compute/storage time used in VTL resolvers, and they want to minimize the potential for someone to abuse that. I would not be surprised if those limits are removed in the future and VTL charges are added to the AppSync billing model. But you may be able to open a ticket with the AppSync team and ask them for a code size limit increase, not sure if that’s currently a soft or hard limit.