fix(amplify-provider-awscloudformation): preserve GraphQLSchema logical id on v1 to v2 migration - #14963
Open
sarayev wants to merge 1 commit into
Open
fix(amplify-provider-awscloudformation): preserve GraphQLSchema logical id on v1 to v2 migration#14963sarayev wants to merge 1 commit into
sarayev wants to merge 1 commit into
Conversation
…al id on v1 to v2 migration On a Gen1 v1 to v2 GraphQL transformer migration the AppSync schema resource's logical id changes from v1's hard-coded `GraphQLSchema` to the v2 CDK-hashed `GraphQLAPITransformerSchema<hash>`. Because the schema's physical id (`<apiId>GraphQLSchema`) is unique per API, CloudFormation attempts a create-before-delete on the rename and fails with CREATE_FAILED `<apiId>GraphQLSchema already exists`, rolling back the deployment. This adds a whole-template pass in `preProcessCFNTemplate` that runs only when the previously-deployed API template still has the schema at logical id `GraphQLSchema`. In that case it rewrites the hashed logical id back to `GraphQLSchema` and fixes every reference (Ref, DependsOn, Fn::GetAtt, Fn::Sub) so CloudFormation performs an in-place update instead of a colliding replacement. The rewrite is migration-gated: born-v2 Gen1 apps, brand-new APIs, non-API templates, and Gen2/CDK consumers are unaffected and produce byte-identical output. The change is confined to amplify-provider-awscloudformation; transformer packages are untouched. --- Prompt: Fix the Gen1 v1 to v2 AppSync GraphQLSchema logical-ID collision entirely within the amplify-cli repo (deploy-time, migration-gated), non-breaking for born-v2 customers; prepare a PR.
sarayev
marked this pull request as ready for review
July 22, 2026 14:14
soberm
approved these changes
Jul 23, 2026
sarayev
enabled auto-merge (squash)
July 23, 2026 15:38
svidgen
reviewed
Jul 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of changes
Deploy-time, migration-gated fix in the Gen1 CLI for the v1 to v2
AWS::AppSync::GraphQLSchemalogical-ID collision.On a v1 to v2 GraphQL transformer migration the schema resource's
logical ID changes from v1's hard-coded
GraphQLSchemato v2'sCDK-hashed
GraphQLAPITransformerSchema<hash>. Because the schema'sphysical ID is
<apiId>GraphQLSchema(one per API), CloudFormationattempts a create-before-delete on the rename and fails with
CREATE_FAILED: <apiId>GraphQLSchema already exists, rolling back themigration deployment.
The fix adds a whole-template pass in
preProcessCFNTemplatethat runsonly when the previously-deployed API template still has the schema
at logical ID
GraphQLSchema. In that case it rewrites the hashedlogical ID back to
GraphQLSchemaand fixes every reference (Ref,DependsOn,Fn::GetAtt,Fn::Sub) — so CloudFormation performs anin-place update instead of a colliding replacement.
The rewrite is migration-gated. Born-v2 Gen1 apps, brand-new APIs,
non-API/nested-stack templates, and Gen2/CDK consumers are unaffected
and produce byte-identical output. The change is confined to
amplify-provider-awscloudformation; transformer packages areuntouched.
Issue #, if available
N/A
Description of how you validated changes
preserveGraphQLSchemaLogicalId, including aborn-v2 byte-identical (no-op) case; all pass.
amplify-provider-awscloudformationsuite green.UPDATE_COMPLETE, the schema resource stayed atLogicalResourceId=GraphQLSchema, and no logical-ID collisionoccurred.
Checklist
yarn testpassesBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.