aws-amplify / amplify-cli

The AWS Amplify CLI is a toolchain for simplifying serverless web and mobile development.
Apache License 2.0
2.83k stars 823 forks source link

Amplify console push failing (There was an error initializing your environment. [INFO]: πŸ›‘ Packaging overrides failed. Cannot find type definition file for 'testing-library__jest-dom') #13841

Closed DevTGhosh closed 4 months ago

DevTGhosh commented 4 months ago

How did you install the Amplify CLI?

npm

If applicable, what version of Node.js are you using?

16.20.2

Amplify CLI Version

12.9.0

What operating system are you using?

Amazon Linux 2

Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.

No manual changes made

Describe the bug

On amplify console build it is failing to update the amplify env

I am able to make changes on my local machine. The amplify console is failing immediately.

It says there is some issue with types in testing-library__jest-domand to fix auth/overide.ts but I haven't made any changes to them in a long while. Error

 βœ… GraphQL schema compiled successfully.

41

Edit your schema at /codebuild/output/src2108184788/src/chedar-online-offline/amplify/backend/api/chedarv2Staging/schema.graphql or place .graphql files in a directory at /codebuild/output/src2108184788/src/chedar-online-offline/amplify/backend/api/chedarv2Staging/schema

42

2024-07-03T10:14:44.594Z [WARNING]: - Building resource api/restApiChedar

43

2024-07-03T10:14:44.614Z [WARNING]: - Building resource api/subscriptionApi

44

2024-07-03T10:14:44.636Z [WARNING]: - Building resource api/webhooks

45

2024-07-03T10:14:44.646Z [WARNING]: - Building resource auth/chedarAuthTest

46

2024-07-03T10:15:04.740Z [WARNING]: βœ– Fetching updates to backend environment: test from the cloud.

47

2024-07-03T10:15:04.745Z [WARNING]: βœ– There was an error initializing your environment.

48

2024-07-03T10:15:05.951Z [INFO]: πŸ›‘ Packaging overrides failed.

49

2024-07-03T10:15:05.952Z [INFO]: Command failed with exit code 2: /codebuild/output/src2108184788/src/chedar-online-offline/amplify/backend/node_modules/.bin/tsc --project /codebuild/output/src2108184788/src/chedar-online-offline/amplify/backend/auth/chedarAuthTest/build/tsconfig.resource.json

50

error TS2688: Cannot find type definition file for 'testing-library__jest-dom'.

51

The file is in the program because:

52

Entry point for implicit type library 'testing-library__jest-dom'

53

Resolution: There may be errors in your overrides file. If so, fix the errors and try again.

54

Learn more at: https://docs.amplify.aws/cli/project/troubleshooting/

55

2024-07-03T10:15:05.963Z [INFO]:

56

2024-07-03T10:15:05.963Z [INFO]: Session Identifier: 67eb67fd-1435-40bd-811f-61211ea7eab6

57

2024-07-03T10:15:06.002Z [ERROR]: !!! Build failed

58

2024-07-03T10:15:06.003Z [ERROR]: !!! Error: Command failed with exit code 1

59

2024-07-03T10:15:06.003Z [INFO]: # Starting environment caching...

60

2024-07-03T10:15:06.004Z [INFO]: # Uploading environment cache artifact...

61

2024-07-03T10:15:06.088Z [INFO]: # Uploaded environment cache artifact

62

2024-07-03T10:15:06.088Z [INFO]: # Environment caching completed

Expected behavior

Amplify console to push the changes

Reproduction steps

  1. Amplify.yml file in build settings using amplify cli version 12.9.0 and Amazon Linux 2

    version: 1
    backend:
    phases:
    build:
      commands:
        - '# Execute Amplify CLI with the helper script'
        - amplifyPush --simple
    frontend:
    phases:
    preBuild:
      commands:
        - nvm use 16
        - npm ci
        - LOGROCKET_ACCESS_ID=${LOGROCKET_ACCESS_ID}
        - SENTRY_AUTH_TOKEN=${SENTRY_AUTH_TOKEN}
        - npm run release
    artifacts:
    baseDirectory: /build
    files:
      - '**/*'
    cache:
    paths:
      - node_modules/**/*
    customHeaders:
    - pattern: '*'
      headers:
      - key: 'Access-Control-Allow-Origin'
        value: '*'
  2. Link a branch to amplify and push.

Project Identifier

9416a52d4390bc60fee0f1de8176ba91

Log output

``` # Put your logs below this line ```

BUILD.txt

Additional information

No response

Before submitting, please confirm:

ykethan commented 4 months ago

Hey @DevTGhosh, thank you for reaching for reaching out. Does the Amplify backend or auth folder contain the testing-library__jest-dom file? Was there any recent changes on project such as tsconfig or upgrade to the Amplify CLI version?

DevTGhosh commented 4 months ago

I couldn't find the the testing-library__jest-dom file anywhere. Anyways after trying making a few changes I was able to make it work by making the following changes: Amplify.yml file in build settings I was facing issues with eslint as well

version: 1
backend:
  phases:
    build:
      commands:
        - '# Execute Amplify CLI with the helper script'
        - npx eslint -v
        - amplifyPush --simple
frontend:
  phases:
    preBuild:
      commands:
        - nvm use 16
        - npm ci --legacy-peer-deps
        - npm run release
  artifacts:
    baseDirectory: /build
    files:
      - '**/*'
  customHeaders:
    - pattern: '*'
      headers:
      - key: 'Access-Control-Allow-Origin'
        value: '*'

Amplify cli version 12.12.4 Build image - Amazon Linux 2023

Why would this solve the issue or why it was caused in the first place is beyond me. But closing the issue for now.

github-actions[bot] commented 4 months ago

This issue is now closed. Comments on closed issues are hard for our team to see. If you need more assistance, please open a new issue that references this one.