aws-amplify / amplify-hosting

AWS Amplify Hosting provides a Git-based workflow for deploying and hosting fullstack serverless web applications.
https://aws.amazon.com/amplify/hosting/
Apache License 2.0
461 stars 116 forks source link

When I build Frontend, the Backend (api) is deleted and the build fails because amplifyconfiguration.json is broken. #3868

Open hyunwoo18 opened 11 months ago

hyunwoo18 commented 11 months ago

Before opening, please confirm:

App Id

d2qkdbb9ctsi6g

AWS Region

us-east-1

Amplify Hosting feature

Backend builds, Frontend builds

Frontend framework

Next.js

Next.js version

14.0.3

Next.js router

N/A

Describe the bug

The following is what used to work:

  1. npx create-next-ap name; cd name
  2. amplify add api and push
  3. aws amplify update-app --app-id --repository "CodeCommit url"--platform WEB_COMPUTE --build-spec "version: 1...."
  4. aws amplify start-job --app-id $myappid --branch-name main --job-type RELEASE Two weeks ago, I noticed that next.js version is now 14.0.3 (used to be 13.0.6 when the above worked) and the step 4 fails now. What I think is a bug is what happens during the build job: "Provision" phase is successful, but during the "Backend" part of"Build" phase, the "api" that I added is deleted and thus the next "Frontend" phase fails because amplifyconfiguration.json is now incomplete as it does not include "api" information (because the api was deleted in the Backend build)

Expected behavior

As described above, the build process should (used to) complete without a problem, but with Next.js 14.0.3 and Amazon 2023 as the build image, during the Backend phase of the build procedure, the api is deleted mysteriously.

Reproduction steps

You can just execute the following:

  1. npx create-next-app@">=13.5.0 <15.0.0" $next_dir_name --js --no-tailwind --no-eslint --no-src-dir --no-app --import-alias "@/*"

  2. cd $next_dir_name

  3. amplify init

  4. amplify add api

  5. amplify push

  6. aws amplify update-app --app-id $myappid \ --repository https://git-codecommit.us-east-1.amazonaws.com/v1/repo...\ --iam-service-role-arn --platform WEB_COMPUTE \ --environment-variables _CUSTOM_IMAGE=amplify:al2023 \ --build-spec "version: 1 frontend: phases: preBuild: commands:

    • npm ci build: commands:
    • npm run build artifacts: baseDirectory: .next files:
      • '*/' cache: paths:
      • node_modules/*/"
  7. aws amplify create-branch --app-id $myappid --branch-name main --backend-environment-arn $myapparn --ttl 5 --enable-auto-build

  8. aws amplify start-job --app-id $myappid --branch-name main --job-type RELEASE

Build Settings

version: 1
frontend:
  phases:
    preBuild:
      commands:
        - npm ci
    build:
      commands:
        - npm run build
  artifacts:
    baseDirectory: .next
    files:
      - '**/*'
  cache:
    paths:
      - node_modules/**/*"
I even added 

backend:
  phases:
    build:
      commands:
        - '# Execute Amplify CLI with the helper script'
        - amplifyPush --simple

But it didn't help. Same failure.

Log output

``` # Put your logs below this line 2023-12-18T03:09:57.319Z [INFO]: # Cloning repository: https://git-codecommit.us-east-1.amazonaws.com/ 2023-12-18T03:10:22.996Z [INFO]: 2023-12-18T03:10:23.155Z [INFO]: Cloning into ''... remote: Counting objects: 105, done. te: Receiving objects: 100% (105/105), 5.95 MiB | 60.97 MiB/s, done. Resolving deltas: 100% (38/38), done.lving deltas: 0% (0/38) 2023-12-18T03:10:23.156Z [INFO]: # Switching to commit: 58468d70b51aeedfca4bd693fed431d6cae6a251 2023-12-18T03:10:23.186Z [INFO]: Note: switching to '58468d70b51aeedfca4bd693fed431d6cae6a251'. You are in 'detached HEAD' state. You can look around, make experimental changes and commit them, and you can discard any commits you make in this state without impacting any branches by switching back to a branch. If you want to create a new branch to retain commits you create, you may do so (now or later) by using -c with the switch command. Example: git switch -c Or undo this operation with: git switch - Turn off this advice by setting config variable advice.detachedHead to false HEAD is now at 58468d7 update13 2023-12-18T03:10:23.278Z [INFO]: Successfully cleaned up Git credentials 2023-12-18T03:10:23.279Z [INFO]: # Checking for Git submodules at: /codebuild/output/src224805242/src//.gitmodules 2023-12-18T03:10:23.287Z [INFO]: # Retrieving environment cache... 2023-12-18T03:10:23.327Z [WARNING]: ! Unable to write cache: {"code":"ERR_BAD_REQUEST","message":"Request failed with status code 404"})} 2023-12-18T03:10:23.328Z [INFO]: ---- Setting Up SSM Secrets ---- 2023-12-18T03:10:23.328Z [INFO]: SSM params {"Path":"/amplify/d1a5d2fkd5lecc/dev/","WithDecryption":true} 2023-12-18T03:10:24.249Z [INFO]: No live updates for this build run 2023-12-18T03:10:24.253Z [INFO]: # Retrieving cache... 2023-12-18T03:10:24.296Z [INFO]: # Retrieved cache 2023-12-18T03:10:41.935Z [INFO]: ## Starting Backend Build ## Checking for associated backend environment... ## Backend environment association found 2023-12-18T03:10:44.193Z [INFO]: Amplify AppID found: d1a5d2fkd5lecc. Amplify App name is: 2023-12-18T03:10:44.242Z [INFO]: Backend environment dev found in Amplify Console app: 2023-12-18T03:10:45.196Z [WARNING]: - Fetching updates to backend environment: dev from the cloud. 2023-12-18T03:10:45.702Z [WARNING]: ✔ Successfully pulled backend environment dev from the cloud. 2023-12-18T03:10:45.730Z [INFO]: ✅ 2023-12-18T03:10:47.672Z [INFO]: Note: It is recommended to run this command from the root of your app directory 2023-12-18T03:10:47.905Z [WARNING]: - Initializing your environment: dev 2023-12-18T03:10:48.416Z [WARNING]: ✔ Initialized provider successfully. 2023-12-18T03:10:54.772Z [INFO]: 2023-12-18T03:10:54.774Z [INFO]: UPDATE_IN_PROGRESS amplify-wholetest3amplify-dev-12608 AWS::CloudFormation::Stack Mon Dec 18 2023 03:10:49 GMT+0000 (Coordinated Universal Time) User Initiated UPDATE_IN_PROGRESS UnauthRole AWS::IAM::Role Mon Dec 18 2023 03:10:53 GMT+0000 (Coordinated Universal Time) UPDATE_IN_PROGRESS AuthRole AWS::IAM::Role Mon Dec 18 2023 03:10:53 GMT+0000 (Coordinated Universal Time) 2023-12-18T03:10:59.781Z [INFO]: 2023-12-18T03:10:59.782Z [INFO]: UPDATE_IN_PROGRESS DeploymentBucket AWS::S3::Bucket Mon Dec 18 2023 03:10:55 GMT+0000 (Coordinated Universal Time) 2023-12-18T03:11:29.845Z [INFO]: 2023-12-18T03:11:29.848Z [INFO]: UPDATE_COMPLETE AuthRole AWS::IAM::Role Mon Dec 18 2023 03:11:10 GMT+0000 (Coordinated Universal Time) UPDATE_COMPLETE UnauthRole AWS::IAM::Role Mon Dec 18 2023 03:11:10 GMT+0000 (Coordinated Universal Time) UPDATE_COMPLETE DeploymentBucket AWS::S3::Bucket Mon Dec 18 2023 03:11:22 GMT+0000 (Coordinated Universal Time) UPDATE_COMPLETE_CLEANUP_IN_PROGRESS amplify-wholetest3amplify-dev-12608 AWS::CloudFormation::Stack Mon Dec 18 2023 03:11:25 GMT+0000 (Coordinated Universal Time) DELETE_IN_PROGRESS apiwholetest3appsyncapi AWS::CloudFormation::Stack Mon Dec 18 2023 03:11:26 GMT+0000 (Coordinated Universal Time) 2023-12-18T03:11:29.910Z [INFO]: 2023-12-18T03:11:29.913Z [INFO]: DELETE_IN_PROGRESS amplify-wholetest3amplify-dev-12608-apiwholetest3appsyncapi-NOYZ4V58487N AWS::CloudFormation::Stack Mon Dec 18 2023 03:11:26 GMT+0000 (Coordinated Universal Time) User Initiated DELETE_IN_PROGRESS CustomResourcesjson AWS::CloudFormation::Stack Mon Dec 18 2023 03:11:29 GMT+0000 (Coordinated Universal Time) DELETE_IN_PROGRESS GraphQLAPIDefaultApiKey215A6DD7 AWS::AppSync::ApiKey Mon Dec 18 2023 03:11:29 GMT+0000 (Coordinated Universal Time) 2023-12-18T03:11:30.104Z [INFO]: 2023-12-18T03:11:30.104Z [INFO]: DELETE_IN_PROGRESS amplify-wholetest3amplify-dev-12608-apiwholetest3appsyncapi-NOYZ4V-CustomResourcesjson-1IIMWXS1CY656 AWS::CloudFormation::Stack Mon Dec 18 2023 03:11:29 GMT+0000 (Coordinated Universal Time) User Initiated 2023-12-18T03:11:59.896Z [INFO]: 2023-12-18T03:11:59.897Z [INFO]: DELETE_COMPLETE GraphQLAPIDefaultApiKey215A6DD7 AWS::AppSync::ApiKey Mon Dec 18 2023 03:11:30 GMT+0000 (Coordinated Universal Time) DELETE_COMPLETE CustomResourcesjson AWS::CloudFormation::Stack Mon Dec 18 2023 03:11:39 GMT+0000 (Coordinated Universal Time) DELETE_IN_PROGRESS Post AWS::CloudFormation::Stack Mon Dec 18 2023 03:11:40 GMT+0000 (Coordinated Universal Time) 2023-12-18T03:12:00.130Z [INFO]: 2023-12-18T03:12:00.136Z [INFO]: DELETE_IN_PROGRESS amplify-wholetest3amplify-dev-12608-apiwholetest3appsyncapi-NOYZ4V58487N-Post-1M3U08J5RFJA7 AWS::CloudFormation::Stack Mon Dec 18 2023 03:11:41 GMT+0000 (Coordinated Universal Time) User Initiated DELETE_IN_PROGRESS SubscriptiononCreatePostResolver AWS::AppSync::Resolver Mon Dec 18 2023 03:11:44 GMT+0000 (Coordinated Universal Time) DELETE_IN_PROGRESS PostIAMRoleDefaultPolicy04190CA0 AWS::IAM::Policy Mon Dec 18 2023 03:11:44 GMT+0000 (Coordinated Universal Time) DELETE_IN_PROGRESS GetPostResolver AWS::AppSync::Resolver Mon Dec 18 2023 03:11:44 GMT+0000 (Coordinated Universal Time) DELETE_IN_PROGRESS ListPostResolver AWS::AppSync::Resolver Mon Dec 18 2023 03:11:44 GMT+0000 (Coordinated Universal Time) DELETE_IN_PROGRESS SubscriptiononUpdatePostResolver AWS::AppSync::Resolver Mon Dec 18 2023 03:11:44 GMT+0000 (Coordinated Universal Time) DELETE_IN_PROGRESS CreatePostResolver AWS::AppSync::Resolver Mon Dec 18 2023 03:11:44 GMT+0000 (Coordinated Universal Time) DELETE_IN_PROGRESS SubscriptiononDeletePostResolver AWS::AppSync::Resolver Mon Dec 18 2023 03:11:44 GMT+0000 (Coordinated Universal Time) DELETE_IN_PROGRESS UpdatePostResolver AWS::AppSync::Resolver Mon Dec 18 2023 03:11:44 GMT+0000 (Coordinated Universal Time) DELETE_IN_PROGRESS DeletePostResolver AWS::AppSync::Resolver Mon Dec 18 2023 03:11:44 GMT+0000 (Coordinated Universal Time) DELETE_IN_PROGRESS DynamoDBAccess71ABE5AE AWS::IAM::Policy Mon Dec 18 2023 03:11:44 GMT+0000 (Coordinated Universal Time) DELETE_COMPLETE SubscriptiononCreatePostResolver AWS::AppSync::Resolver Mon Dec 18 2023 03:11:45 GMT+0000 (Coordinated Universal Time) DELETE_COMPLETE UpdatePostResolver AWS::AppSync::Resolver Mon Dec 18 2023 03:11:45 GMT+0000 (Coordinated Universal Time) DELETE_COMPLETE PostIAMRoleDefaultPolicy04190CA0 AWS::IAM::Policy Mon Dec 18 2023 03:11:45 GMT+0000 (Coordinated Universal Time) DELETE_COMPLETE GetPostResolver AWS::AppSync::Resolver Mon Dec 18 2023 03:11:45 GMT+0000 (Coordinated Universal Time) DELETE_COMPLETE CreatePostResolver AWS::AppSync::Resolver Mon Dec 18 2023 03:11:45 GMT+0000 (Coordinated Universal Time) DELETE_COMPLETE SubscriptiononDeletePostResolver AWS::AppSync::Resolver Mon Dec 18 2023 03:11:45 GMT+0000 (Coordinated Universal Time) DELETE_COMPLETE DeletePostResolver AWS::AppSync::Resolver Mon Dec 18 2023 03:11:45 GMT+0000 (Coordinated Universal Time) DELETE_COMPLETE DynamoDBAccess71ABE5AE AWS::IAM::Policy Mon Dec 18 2023 03:11:45 GMT+0000 (Coordinated Universal Time) DELETE_IN_PROGRESS MutationUpdatePostDataResolverFnMutationUpdatePostDataResolverFnAppSyncFunctionBF7D410D AWS::AppSync::FunctionConfiguration Mon Dec 18 2023 03:11:45 GMT+0000 (Coordinated Universal Time) DELETE_IN_PROGRESS MutationupdatePostinit0FunctionMutationupdatePostinit0FunctionAppSyncFunctionBAC7D532 AWS::AppSync::FunctionConfiguration Mon Dec 18 2023 03:11:45 GMT+0000 (Coordinated Universal Time) DELETE_IN_PROGRESS MutationcreatePostinit0FunctionMutationcreatePostinit0FunctionAppSyncFunction9E444A7F AWS::AppSync::FunctionConfiguration Mon Dec 18 2023 03:11:46 GMT+0000 (Coordinated Universal Time) DELETE_IN_PROGRESS QueryGetPostDataResolverFnQueryGetPostDataResolverFnAppSyncFunction06724190 AWS::AppSync::FunctionConfiguration Mon Dec 18 2023 03:11:46 GMT+0000 (Coordinated Universal Time) DELETE_IN_PROGRESS MutationCreatePostDataResolverFnMutationCreatePostDataResolverFnAppSyncFunctionE45E2000 AWS::AppSync::FunctionConfiguration Mon Dec 18 2023 03:11:46 GMT+0000 (Coordinated Universal Time) DELETE_IN_PROGRESS MutationDeletePostDataResolverFnMutationDeletePostDataResolverFnAppSyncFunction45B37C12 AWS::AppSync::FunctionConfiguration Mon Dec 18 2023 03:11:46 GMT+0000 (Coordinated Universal Time) DELETE_COMPLETE MutationupdatePostinit0FunctionMutationupdatePostinit0FunctionAppSyncFunctionBAC7D532 AWS::AppSync::FunctionConfiguration Mon Dec 18 2023 03:11:47 GMT+0000 (Coordinated Universal Time) DELETE_COMPLETE MutationCreatePostDataResolverFnMutationCreatePostDataResolverFnAppSyncFunctionE45E2000 AWS::AppSync::FunctionConfiguration Mon Dec 18 2023 03:11:47 GMT+0000 (Coordinated Universal Time) DELETE_COMPLETE MutationcreatePostinit0FunctionMutationcreatePostinit0FunctionAppSyncFunction9E444A7F AWS::AppSync::FunctionConfiguration Mon Dec 18 2023 03:11:47 GMT+0000 (Coordinated Universal Time) DELETE_COMPLETE MutationUpdatePostDataResolverFnMutationUpdatePostDataResolverFnAppSyncFunctionBF7D410D AWS::AppSync::FunctionConfiguration Mon Dec 18 2023 03:11:47 GMT+0000 (Coordinated Universal Time) DELETE_COMPLETE QueryGetPostDataResolverFnQueryGetPostDataResolverFnAppSyncFunction06724190 AWS::AppSync::FunctionConfiguration Mon Dec 18 2023 03:11:47 GMT+0000 (Coordinated Universal Time) DELETE_COMPLETE MutationDeletePostDataResolverFnMutationDeletePostDataResolverFnAppSyncFunction45B37C12 AWS::AppSync::FunctionConfiguration Mon Dec 18 2023 03:11:47 GMT+0000 (Coordinated Universal Time) DELETE_COMPLETE ListPostResolver AWS::AppSync::Resolver Mon Dec 18 2023 03:11:48 GMT+0000 (Coordinated Universal Time) DELETE_COMPLETE SubscriptiononUpdatePostResolver AWS::AppSync::Resolver Mon Dec 18 2023 03:11:49 GMT+0000 (Coordinated Universal Time) DELETE_IN_PROGRESS QueryListPostsDataResolverFnQueryListPostsDataResolverFnAppSyncFunction3D526AB7 AWS::AppSync::FunctionConfiguration Mon Dec 18 2023 03:11:49 GMT+0000 (Coordinated Universal Time) DELETE_IN_PROGRESS SubscriptionOnCreatePostDataResolverFnSubscriptionOnCreatePostDataResolverFnAppSyncFunctionB4572868 AWS::AppSync::FunctionConfiguration Mon Dec 18 2023 03:11:49 GMT+0000 (Coordinated Universal Time) DELETE_IN_PROGRESS QuerygetPostpostAuth0FunctionQuerygetPostpostAuth0FunctionAppSyncFunctionC72E5C0F AWS::AppSync::FunctionConfiguration Mon Dec 18 2023 03:11:49 GMT+0000 (Coordinated Universal Time) DELETE_COMPLETE QueryListPostsDataResolverFnQueryListPostsDataResolverFnAppSyncFunction3D526AB7 AWS::AppSync::FunctionConfiguration Mon Dec 18 2023 03:11:50 GMT+0000 (Coordinated Universal Time) DELETE_COMPLETE SubscriptionOnCreatePostDataResolverFnSubscriptionOnCreatePostDataResolverFnAppSyncFunctionB4572868 AWS::AppSync::FunctionConfiguration Mon Dec 18 2023 03:11:50 GMT+0000 (Coordinated Universal Time) DELETE_COMPLETE QuerygetPostpostAuth0FunctionQuerygetPostpostAuth0FunctionAppSyncFunctionC72E5C0F AWS::AppSync::FunctionConfiguration Mon Dec 18 2023 03:11:51 GMT+0000 (Coordinated Universal Time) DELETE_IN_PROGRESS PostDataSource AWS::AppSync::DataSource Mon Dec 18 2023 03:11:51 GMT+0000 (Coordinated Universal Time) DELETE_COMPLETE PostDataSource AWS::AppSync::DataSource Mon Dec 18 2023 03:11:52 GMT+0000 (Coordinated Universal Time) DELETE_IN_PROGRESS PostIAMRole83BF708F AWS::IAM::Role Mon Dec 18 2023 03:11:53 GMT+0000 (Coordinated Universal Time) DELETE_IN_PROGRESS PostTable AWS::DynamoDB::Table Mon Dec 18 2023 03:11:53 GMT+0000 (Coordinated Universal Time) 2023-12-18T03:12:30.113Z [INFO]: 2023-12-18T03:12:30.114Z [INFO]: DELETE_COMPLETE PostTable AWS::DynamoDB::Table Mon Dec 18 2023 03:12:25 GMT+0000 (Coordinated Universal Time) 2023-12-18T03:34:00.150Z [INFO]: 2023-12-18T03:34:00.152Z [INFO]: DELETE_COMPLETE Post AWS::CloudFormation::Stack Mon Dec 18 2023 03:33:55 GMT+0000 (Coordinated Universal Time) DELETE_IN_PROGRESS GraphQLAPITransformerSchema3CB2AE18 AWS::AppSync::GraphQLSchema Mon Dec 18 2023 03:33:55 GMT+0000 (Coordinated Universal Time) DELETE_IN_PROGRESS GraphQLAPINONEDS95A13CF0 AWS::AppSync::DataSource Mon Dec 18 2023 03:33:55 GMT+0000 (Coordinated Universal Time) DELETE_COMPLETE GraphQLAPINONEDS95A13CF0 AWS::AppSync::DataSource Mon Dec 18 2023 03:33:56 GMT+0000 (Coordinated Universal Time) DELETE_COMPLETE GraphQLAPITransformerSchema3CB2AE18 AWS::AppSync::GraphQLSchema Mon Dec 18 2023 03:33:57 GMT+0000 (Coordinated Universal Time) DELETE_IN_PROGRESS GraphQLAPI AWS::AppSync::GraphQLApi Mon Dec 18 2023 03:33:57 GMT+0000 (Coordinated Universal Time) DELETE_COMPLETE GraphQLAPI AWS::AppSync::GraphQLApi Mon Dec 18 2023 03:33:59 GMT+0000 (Coordinated Universal Time) DELETE_COMPLETE amplify-wholetest3amplify-dev-12608-apiwholetest3appsyncapi-NOYZ4V58487N AWS::CloudFormation::Stack Mon Dec 18 2023 03:33:59 GMT+0000 (Coordinated Universal Time) 2023-12-18T03:36:23.335Z [INFO]: 2023-12-18T03:36:23.564Z [WARNING]: - Uploading files. 2023-12-18T03:36:23.975Z [WARNING]: - Uploading files. 2023-12-18T03:36:24.033Z [WARNING]: - Uploading files. 2023-12-18T03:36:24.142Z [INFO]: 2023-12-18T03:36:24.143Z [INFO]: 2023-12-18T03:36:24.249Z [INFO]: ✅ Initialized your environment successfully. 2023-12-18T03:36:24.250Z [INFO]: ✅ Your project has been successfully initialized and connected to the cloud! Some next steps: "amplify status" will show you what you've added already and if it's locally configured or deployed "amplify add " will allow you to add features like user login or a backend API "amplify push" will build all your local backend resources and provision it in the cloud "amplify console" to open the Amplify Console and view your project status "amplify publish" will build all your local backend and frontend resources (if you have hosting category added) and provision it in the cloud Pro tip: Try "amplify add api" to create a backend API and then "amplify push" to deploy everything 2023-12-18T03:36:25.746Z [INFO]: ## Completed Backend Build 2023-12-18T03:36:25.751Z [INFO]: ## Starting Frontend Build # Starting phase: preBuild 2023-12-18T03:36:25.751Z [INFO]: # Executing command: npm ci 2023-12-18T03:36:50.131Z [INFO]: added 336 packages, and audited 337 packages in 17s 2023-12-18T03:36:50.133Z [INFO]: 26 packages are looking for funding run `npm fund` for details found 0 vulnerabilities 2023-12-18T03:36:50.152Z [INFO]: # Completed phase: preBuild # Starting phase: build # Executing command: npm run build 2023-12-18T03:36:50.577Z [INFO]: > newfrontend@0.1.0 build > next build 2023-12-18T03:36:51.221Z [INFO]: ⚠ No build cache found. Please configure build caching for faster rebuilds. Read more: https://nextjs.org/docs/messages/no-cache 2023-12-18T03:36:51.277Z [INFO]: Attention: Next.js now collects completely anonymous telemetry regarding usage. 2023-12-18T03:36:51.277Z [INFO]: This information is used to shape Next.js' roadmap and prioritize features. You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL: https://nextjs.org/telemetry 2023-12-18T03:36:51.364Z [INFO]: Linting and checking validity of types ... 2023-12-18T03:36:51.500Z [INFO]: ▲ Next.js 14.0.3 2023-12-18T03:36:51.501Z [INFO]: Creating an optimized production build ... 2023-12-18T03:36:58.647Z [INFO]: ✓ Compiled successfully 2023-12-18T03:36:58.648Z [INFO]: Collecting page data ... 2023-12-18T03:36:59.724Z [WARNING]: [WARN] 36:59.718 GraphQLAPI resolveConfig - The API configuration is missing. This is likely due to Amplify.configure() not being called prior to generateClient(). 2023-12-18T03:36:59.724Z [WARNING]: [WARN] 36:59.724 GraphQLAPI resolveConfig - The API configuration is missing. This is likely due to Amplify.configure() not being called prior to generateClient(). 2023-12-18T03:36:59.726Z [WARNING]: Error: No credentials at GraphQLAPIClass._headerBasedAuth (file:///codebuild/output/src224805242/src/newfrontend/node_modules/@aws-amplify/api-graphql/dist/esm/internals/InternalGraphQLAPI.mjs:54:27) at async GraphQLAPIClass._graphql (file:///codebuild/output/src224805242/src/newfrontend/node_modules/@aws-amplify/api-graphql/dist/esm/internals/InternalGraphQLAPI.mjs:162:18) at async /codebuild/output/src224805242/src/newfrontend/.next/server/pages/index.js:1:16144 2023-12-18T03:36:59.727Z [WARNING]: 2023-12-18T03:36:59.728Z [WARNING]: > Build error occurred 2023-12-18T03:36:59.729Z [WARNING]: Error: Failed to collect page data for / at /codebuild/output/src224805242/src/newfrontend/node_modules/next/dist/build/utils.js:1217:15 { type: 'Error' } 2023-12-18T03:36:59.762Z [ERROR]: !!! Build failed 2023-12-18T03:36:59.763Z [INFO]: Please read more about Amplify Hosting's support for SSR frameworks to find if your build failure is related to an unsupported feature: https://docs.aws.amazon.com/amplify/latest/userguide/amplify-ssr-framework-support.html. You may also find this troubleshooting guide useful: https://docs.aws.amazon.com/amplify/latest/userguide/troubleshooting-ssr-deployment.html 2023-12-18T03:36:59.763Z [ERROR]: !!! Non-Zero Exit Code detected 2023-12-18T03:36:59.763Z [INFO]: # Starting environment caching... 2023-12-18T03:36:59.763Z [INFO]: # Environment caching completed Terminating logging... ```

Additional information

Like I said above, this series of commands used to successfully build, but now with the following changes, the build of Frontend fails because the Backend part deletes the api that I added: The changes that are believed to cause this are:

  1. Next.js 14.0.3. The previous working version was 13.0.6
  2. Amazon Linux 2 build image has Node 16 which does not support Next 14.0.3, so I have to instead use Amazon 2023. These are the only major changes to my workflow.

If this is not a bug, I hope you can at least find out why the "Backend" build process "deletes" the api and let me know. Thanks!