1

When I change a resolver ID as follows:

From: new appsync.Resolver(scope, "SuperResolver",.....

To: new appsync.Resolver(scope, "MegaResolver",.....

i.e from "SuperResolver" to "MegaResolver" and then I run cdk deploy, I get the following error:

Only one resolver is allowed per field. (Service: AWSAppSync; Status Code: 400; Error Code: BadRequestException; Request ID: fd68b0ff-38a5-4149-a797-138baf6a836c; Proxy: null

It appears that instead of replacing the ID of the existing resolver (or deleting the construct with the old ID and creating a new one with the new ID), AppSync tries to attach a new resolver to the GQL field.

But the error is rather bogus, so my assumption may be incorrect.

Did anyone experience such a problem? Any help would be much appreciated :)

Hairi
  • 3,318
  • 2
  • 29
  • 68

1 Answers1

3

It's because CloudFormation firstly creates new resources before it deletes old ones. In this case you have to delete resolver in one deploy and add new one in the next.

Lasek
  • 290
  • 1
  • 3
  • 1
    You sure about that? That will result in endpoint(for a the specific field operation to which the resolver is attached) downtime. – Hairi Jul 28 '22 at 12:27
  • Yes I'm sure. I know, but this is what it is, you cant change logical id without recreate the resource. And if you can only have one resource it will be a downtime. See https://stackoverflow.com/questions/51269818/is-it-possible-to-change-the-logical-id-of-an-rds-instance-in-a-cloud-formation – Lasek Jul 28 '22 at 12:40
  • 1
    in this case you have to change `fieldName` as well, if it is the same field just leave logical id as is – Lasek Jul 28 '22 at 12:42
  • Thanks @Lasek. I've been thinking about how to employ (least painfully) a feature toggling approach. Developing different resolver for this field and switch/toggle between the two via configuration. – Hairi Jul 28 '22 at 15:04