amplify-backend icon indicating copy to clipboard operation
amplify-backend copied to clipboard

disableOperations breaks sandbox

Open jan-osch opened this issue 4 months ago • 1 comments

Environment information

System:
  OS: macOS 15.5
  CPU: (10) arm64 Apple M1 Max
  Memory: 194.42 MB / 32.00 GB
  Shell: /bin/zsh
Binaries:
  Node: 20.19.0 - ~/.local/state/fnm_multishells/37246_1752595324283/bin/node
  Yarn: undefined - undefined
  npm: 10.8.2 - ~/.local/state/fnm_multishells/37246_1752595324283/bin/npm
  pnpm: 10.13.1 - ~/.local/state/fnm_multishells/37246_1752595324283/bin/pnpm
NPM Packages:
  @aws-amplify/auth-construct: 1.8.1
  @aws-amplify/backend: 1.16.1
  @aws-amplify/backend-ai: Not Found
  @aws-amplify/backend-auth: 1.7.1
  @aws-amplify/backend-cli: 1.8.0
  @aws-amplify/backend-data: 1.6.1
  @aws-amplify/backend-deployer: 2.1.3
  @aws-amplify/backend-function: 1.14.1
  @aws-amplify/backend-output-schemas: 1.7.0
  @aws-amplify/backend-output-storage: 1.3.1
  @aws-amplify/backend-secret: 1.4.0
  @aws-amplify/backend-storage: 1.4.1
  @aws-amplify/cli-core: 2.2.1
  @aws-amplify/client-config: 1.8.0
  @aws-amplify/data-construct: 1.16.3
  @aws-amplify/data-schema: 1.21.0
  @aws-amplify/deployed-backend-client: 1.8.0
  @aws-amplify/form-generator: 1.2.1
  @aws-amplify/model-generator: 1.2.0
  @aws-amplify/platform-core: 1.10.0
  @aws-amplify/plugin-types: 1.11.0
  @aws-amplify/sandbox: 2.1.2
  @aws-amplify/schema-generator: 1.4.0
  @aws-cdk/toolkit-lib: 1.1.1
  aws-amplify: 6.15.2
  aws-cdk-lib: 2.189.1
  typescript: 5.8.3
No AWS environment variables
No CDK environment variables

Describe the bug

Title

AWS Amplify Gen 2 Sandbox fails when using disableOperations on models

Description

The AWS Amplify Gen 2 sandbox environment fails to start when models have disableOperations configured, even though this is a valid schema configuration.

Steps to Reproduce

  1. Create a new AWS Amplify Gen 2 project
  2. Define a schema with a model that has disableOperations configured:
export const schema = a.schema({
    Customer: a
        .model({
            id: a.id(),
            name: a.string(),
        })
        .disableOperations(["queries"])
        .authorization(allow => [allow.publicApiKey()]),
});
  1. Run npx ampx sandbox
  2. Observe sandbox startup failure

Expected Behavior

The sandbox should start successfully and the model should have queries disabled as specified in the schema.

Actual Behavior

The sandbox fails to start with a CloudFormation error. When disableOperations(["queries"]) is commented out, the sandbox works normally.

Error Details

Embedded stack arn:aws:cloudformation:eu-central-1:<account-id>:stack/amplify-poc-..... was not successfully updated. Currently in UPDATE_ROLLBACK_IN_PROGRESS with reason: The following resource(s) failed to update: [amplifyDataGraphQLAPITransformerSchemaFF50A789, amplifyDataCustomerNestedStackCustomerNestedStackResourceD7D0A0AF].

The error indicates that the GraphQL API transformer schema and the Customer nested stack resources failed to update during CloudFormation deployment.

Environment

  • Node.js: v20.19.0
  • AWS Amplify Backend: 1.16.1
  • AWS Amplify Backend CLI: 1.8.0
  • AWS CDK: 2.189.1
  • TypeScript: 5.8.3
  • AWS Amplify (Frontend): 6.15.2
  • Region: eu-central-1

Additional Context

This appears to be a sandbox-specific issue, as disableOperations is a valid schema configuration in AWS Amplify Gen 2. The workaround is to temporarily comment out the disableOperations line during local development.

Impact

This prevents developers from testing schemas with disabled operations in the local sandbox environment, requiring workarounds during development.

Reproduction steps

npx ampx sandbox

jan-osch avatar Jul 15 '25 16:07 jan-osch

Hey @jan-osch thanks for reaching out. I was able to reproduce this and oddly enough, having another model in the schema allows sandbox to deploy successfully for me. Marking as a bug.

rtpascual avatar Jul 16 '25 22:07 rtpascual