amplify-cli: Build of api failed: missing api-params.json

Which Category is your question related to? Build amplify with the newest version of amplify-cli

Amplify CLI Version 7.5.5

What AWS Services are you utilizing? amplify

App ID and region: do5lfh5kuwuas, eu-west-1

Provide additional details e.g. code snippets ✔ Initialized provider successfully. 2021-12-01T14:48:28.059Z [INFO]: 🛑 Error reading api-params.json file for MYAPI resource 2021-12-01T14:48:28.118Z [WARNING]: ✖ An error occurred when pushing the resources to the cloud 2021-12-01T14:48:28.120Z [WARNING]: ✖ There was an error initializing your environment. 2021-12-01T14:48:28.123Z [INFO]: Error: File at path: '/codebuild/output/src918130845/src/***/amplify/backend/api/MYAPI/api-params.json' does not exist  at Function.JSONUtilities.readJson (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/amplify-cli-core/src/jsonUtilities.ts:25:15)  at ApigwInputState.migrateApigwResource (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/@aws-amplify/amplify-category-api/src/provider-utils/awscloudformation/apigw-input-state.ts:127:44)  at runMicrotasks (<anonymous>)  at processTicksAndRejections (internal/process/task_queues.js:97:5) 2021-12-01T14:48:28.147Z [ERROR]: !!! Build failed 2021-12-01T14:48:28.147Z [ERROR]: !!! Non-Zero Exit Code detected

I am having this issue with the latest version of amplify-cli. No problem with 7.5.4.

Indeed the required file does not exist and never existed! No problem until today.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 22 (11 by maintainers)

Most upvoted comments

Same problem here, everything worked until two days ago.

First error noticed this morning was File at path: '/codebuild/output/src781572205/src/preorder-aws/amplify/backend/api/AdminQueries/api-params.json' does not exist

Then when retrying the error became this (without touching the codebase)

TypeError: Cannot read property 'updateamplifyMetaAfterResourceUpdate' of undefined
    at ApigwInputState.updateAdminQueriesResource (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/@aws-amplify/amplify-category-api/src/provider-utils/awscloudformation/apigw-input-state.ts:69:32)
     at migrateResourceNonContainer (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/@aws-amplify/amplify-category-api/src/provider-utils/awscloudformation/index.ts:295:10)
     at async Promise.all (index 0)
     at migrate (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/@aws-amplify/amplify-category-api/src/index.ts:77:3)
     at loadApiCliInputs (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/amplify-provider-awscloudformation/src/utils/consolidate-apigw-policies.ts:260:7)
     at consolidateApiGatewayPolicies (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/amplify-provider-awscloudformation/src/utils/consolidate-apigw-policies.ts:193:23)
     at createEnvLevelConstructs (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/amplify-provider-awscloudformation/src/utils/env-level-constructs.ts:24:5)
     at Object.run (/root/.nvm/versions/node/v12.21.0/lib/node_modules/@aws-amplify/cli/node_modules/amplify-provider-awscloudformation/src/push-resources.ts:114:5)

Noticed the error just on CI/CD, I’ve not tried it locally yet. My API was created more than 1 year ago.

Seeing a similar issue, no changes were made to my code base, but builds are failing in the CI/CD system. Building/publishing locally works using CLI 6.3.1 that is on my machine. The build worked yesterday, and I just re-triggered the same branch to build through amplify console and it fails to update Lambdas with:

UPDATE_FAILED               functionXXXX        AWS::CloudFormation::Stack Wed Dec 01 2021 16:03:08 GMT+0000 (Coordinated Universal Time) Parameters: [s3Key, deploymentBucketName] must have values
UPDATE_FAILED               functionYYYY        AWS::CloudFormation::Stack Wed Dec 01 2021 16:03:08 GMT+0000 (Coordinated Universal Time) Parameters: [s3Key, deploymentBucketName] must have values
UPDATE_FAILED               functionZZZZ           AWS::CloudFormation::Stack Wed Dec 01 2021 16:03:08 GMT+0000 (Coordinated Universal Time) Parameters: [s3Key, deploymentBucketName] must have values

Confirmed working in CI/CD if I pin version 7.5.4 of Amplify CLI in the Amplify portal build settings. The issue seems to have been introduced in 7.5.5