Skip to content

[Bug]: ampx sandbox GraphQL schema permanently wedges in the cloud after rapid saves, requiring a full 'sandbox delete' to fix #3255

Description

@sampaio96

Environment information

System:
  OS: macOS 26.5.1
  CPU: (10) arm64 Apple M5
  Memory: 187.42 MB / 24.00 GB
  Shell: /bin/zsh
Binaries:
  Node: 24.14.0 - ~/.nvm/versions/node/v24.14.0/bin/node
  Yarn: 1.22.22 - ~/.nvm/versions/node/v24.14.0/bin/yarn
  npm: 11.9.0 - ~/.nvm/versions/node/v24.14.0/bin/npm
  pnpm: 10.33.2 - ~/.nvm/versions/node/v24.14.0/bin/pnpm
NPM Packages:
  @aws-amplify/auth-construct: 1.11.2
  @aws-amplify/backend: 1.23.0
  @aws-amplify/backend-ai: Not Found
  @aws-amplify/backend-auth: 1.9.4
  @aws-amplify/backend-cli: 1.8.3
  @aws-amplify/backend-data: 1.7.0
  @aws-amplify/backend-function: 1.18.1
  @aws-amplify/backend-output-schemas: 1.8.0
  @aws-amplify/backend-output-storage: 1.3.5
  @aws-amplify/backend-secret: 1.4.2
  @aws-amplify/backend-storage: 1.5.0
  @aws-amplify/cli-core: 2.2.5
  @aws-amplify/client-config: 1.10.2
  @aws-amplify/data-construct: 1.17.3
  @aws-amplify/data-schema: 1.26.0
  @aws-amplify/deployed-backend-client: 1.8.2
  @aws-amplify/form-generator: 1.2.7
  @aws-amplify/model-generator: 1.2.3
  @aws-amplify/platform-core: 1.11.1
  @aws-amplify/plugin-types: 1.12.1
  @aws-amplify/sandbox: 2.2.1
  @aws-amplify/schema-generator: 1.4.1
  @aws-cdk/toolkit-lib: 1.19.0
  aws-amplify: Not Found
  aws-cdk-lib: 2.258.0
  typescript: 6.0.3
AWS environment variables:
  AWS_EC2_METADATA_DISABLED = true
No CDK environment variables

Describe the bug:
When using npx ampx sandbox, making structural changes to custom mutations in amplify/data/resource.ts (specifically renaming arguments) can cause the cloud deployment state to become permanently wedged.

When the argument is renamed and the file is saved, the Sandbox triggers a deployment that completes rapidly (~11 seconds). However, the AWS::AppSync::GraphQLSchema does not update in the cloud.

Crucially, this is not a local caching issue. Killing the sandbox process, wiping the .amplify folder, wiping node_modules/.cache, and restarting the sandbox does not fix it. The synthesizer runs, CDK completes the deployment in ~10 seconds with 0 changes detected, and the AppSync schema remains permanently stale.

The ONLY way to un-wedge the schema and get the updates to deploy is to completely tear down the cloud environment (npx ampx sandbox delete) and recreate it from scratch.

To Reproduce:

  1. Create a custom mutation in amplify/data/resource.ts with a specific argument name (e.g., staleBugTest):
updateHanblueCentralDeviceShadow: a.mutation()
  .arguments({ id: a.id().required(), staleBugTest: a.string().required(), state: a.json().required()  })
  .returns(a.ref('HanblueCentralDeviceShadow'))
  .authorization(allow => [allow.authenticated()])
  .handler(a.handler.custom({ dataSource: 'IoTDataEndpoint', entry: getResolver('updateDeviceShadow.js') })),
  1. Run npx ampx sandbox. Allow it to deploy.
  2. In the code editor, revert the argument name from staleBugTest back to shadowName. Save the file.
  3. If multiple rapid saves occur (triggering "Detected file changes while previous deployment was in progress"), the cloud state wedges.
  4. The Sandbox completes the deployment in ~11 seconds, but no AWS::AppSync::GraphQLSchema update occurs in the logs.
  5. Check the AWS AppSync Console. The schema is permanently stuck expecting the old staleBugTest argument.
  6. Kill the sandbox (Ctrl+C), delete local artifacts (rm -rf .amplify), and restart npx ampx sandbox. The deployment still skips the schema update.
  7. Run npx ampx sandbox delete, then npx ampx sandbox. The schema finally deploys correctly with shadowName.

Expected behavior:
CDK/CloudFormation must correctly evaluate the diff between the local resource.ts file and the deployed AppSync schema. Hotswaps or rapid saves must not permanently corrupt the state tracking of the AWS::AppSync::GraphQLSchema resource to the point where a full stack teardown is required to push a schema update.

Metadata

Metadata

Assignees

No one assigned

    Labels

    pending-triageIncoming issues that need categorization

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions