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

amplify_output.json not updated (updated async after a day) after each deployment

Open scorobogaci opened this issue 1 year ago • 4 comments

Environment information

System:
  OS: macOS 14.5
  CPU: (8) arm64 Apple M1
  Memory: 62.39 MB / 16.00 GB
  Shell: /bin/zsh
Binaries:
  Node: 20.15.0 - ~/.nvm/versions/node/v20.15.0/bin/node
  Yarn: 1.22.19 - /opt/homebrew/bin/yarn
  npm: 10.7.0 - ~/.nvm/versions/node/v20.15.0/bin/npm
  pnpm: undefined - undefined
NPM Packages:
  @aws-amplify/auth-construct: 1.3.1
  @aws-amplify/backend: 1.3.0
  @aws-amplify/backend-auth: 1.2.0
  @aws-amplify/backend-cli: 1.2.8
  @aws-amplify/backend-data: 1.1.4
  @aws-amplify/backend-deployer: 1.1.4
  @aws-amplify/backend-function: 1.5.0
  @aws-amplify/backend-output-schemas: 1.2.0
  @aws-amplify/backend-output-storage: 1.1.2
  @aws-amplify/backend-secret: 1.1.3
  @aws-amplify/backend-storage: 1.2.0
  @aws-amplify/cli-core: 1.1.3
  @aws-amplify/client-config: 1.3.2
  @aws-amplify/deployed-backend-client: 1.4.1
  @aws-amplify/form-generator: 1.0.3
  @aws-amplify/model-generator: 1.0.8
  @aws-amplify/platform-core: 1.1.0
  @aws-amplify/plugin-types: 1.3.0
  @aws-amplify/sandbox: 1.2.2
  @aws-amplify/schema-generator: 1.2.4
  aws-amplify: 6.6.2
  aws-cdk: 2.159.1
  aws-cdk-lib: 2.159.1
  typescript: 5.6.2
AWS environment variables:
  AWS_STS_REGIONAL_ENDPOINTS = regional
  AWS_NODEJS_CONNECTION_REUSE_ENABLED = 1
  AWS_SDK_LOAD_CONFIG = 1
No CDK environment variables

Describe the bug

When using Amplify Gen 2 , and making some updates in data/resource.ts (AppSync schema), the updates on models, configurations are not reflected in amplify_output.json after the deployment succeeded. Even though the logs (deployment logs) shows [INFO]: File written: amplify_outputs.json in fact latest changes are not written there.

Funny fact, if you download the amplify_output.json the next day, changes are reflected ))) The most hilarious bug ever seen I guess (some async things going on)

Here is the backend build in amplify.yml

backend:
  phases:
    build:
      commands:
        - npm ci --cache .npm --prefer-offline
        - npx ampx pipeline-deploy --branch $AWS_BRANCH --app-id $AWS_APP_ID

Reproduction steps

Given the following schema

const schema = a.schema({
  Account: a.model({
    identity: a.id().required(),
    email: a.email()
  }).identifier(['identity']).authorization(allow => [allow.owner()])
})

Add a new model for example :

const schema = a.schema({
  Todo: a
      .model({
        content: a.string(),
      }).authorization(allow => [allow.owner()]),
  Account: a.model({
    identity: a.id().required(),
    email: a.email()
  }).identifier(['identity']).authorization(allow => [allow.owner()])
})

Expected is that after deployment using CI/CD Gen 2, the types and everything regarding new model should be defined and written in the amplify_outputs.json, while this is not happening (the file get's updated only after a day)

scorobogaci avatar Sep 28 '24 13:09 scorobogaci