0

I created a project with vite --template react-ts and i can't understand this error

2023-03-08T15:11:58.531Z [INFO]: Cloning into 'frontend'...
2023-03-08T15:11:58.532Z [INFO]: # Checking for Git submodules at: /codebuild/output/src389073204/src/frontend/.gitmodules
2023-03-08T15:11:58.540Z [INFO]: # Retrieving environment cache...
2023-03-08T15:11:58.585Z [WARNING]: ! Unable to write cache: {"code":"ERR_BAD_REQUEST","message":"Request failed with status code 404"})}
2023-03-08T15:11:58.586Z [INFO]: ---- Setting Up SSM Secrets ----
2023-03-08T15:11:58.586Z [INFO]: SSM params {"Path":"/amplify/d1h59jjie2t1ia/main/","WithDecryption":true}
2023-03-08T15:11:58.613Z [WARNING]: !Failed to set up process.env.secrets
2023-03-08T15:12:10.042Z [INFO]: # Node version 18 is available for installation
2023-03-08T15:12:10.190Z [INFO]: # Installing Node version 18
2023-03-08T15:12:14.913Z [INFO]: # Now using Node version 18
2023-03-08T15:12:14.995Z [INFO]: # Retrieving cache...
2023-03-08T15:12:15.038Z [INFO]: # Retrieved cache
2023-03-08T15:12:17.484Z [INFO]: ## Starting Backend Build
                                 ## Checking for associated backend environment...
                                 ## No backend environment association found, continuing...
2023-03-08T15:12:17.484Z [INFO]: ## Completed Backend Build
2023-03-08T15:12:17.486Z [INFO]: ## Starting Frontend Build
                                 # Starting phase: preBuild
2023-03-08T15:12:17.486Z [INFO]: # Executing command: yarn install
2023-03-08T15:12:17.511Z [WARNING]: node: /lib64/libm.so.6: version `GLIBC_2.27' not found (required by node)
                                    node: /lib64/libc.so.6: version `GLIBC_2.28' not found (required by node)
2023-03-08T15:12:17.512Z [ERROR]: !!! Build failed
2023-03-08T15:12:17.512Z [ERROR]: !!! Non-Zero Exit Code detected
2023-03-08T15:12:17.512Z [INFO]: # Starting environment caching...
2023-03-08T15:12:17.512Z [INFO]: # Environment caching completed
Terminating logging...

My compilation settings

version: 1
frontend:
  phases:
    preBuild:
      commands:
        - yarn install
    build:
      commands:
        - yarn run build
  artifacts:
    # IMPORTANT - Please verify your build output directory
    baseDirectory: dist/
    files:
      - '**/*'
  cache:
    paths:
      - node_modules/**/*

I tried changing the build location and changing the application name in amplify, as well as changing the node version

4
  • If it is failing to build the front-end, see if you can build is locally first, before sending it to AWS Amplify
    – Luke
    Commented Mar 8, 2023 at 15:52
  • @felipe I have a similar sequence of warnings and errors. Did you find the solution to this?
    – Steven
    Commented Mar 10, 2023 at 18:01
  • My build locally is working, I still can't solve the problem =/ Commented Mar 12, 2023 at 14:05
  • I couldn't solve the problem yet, I uploaded it to netlify. We identified that VITE needs to access environment variables during build time, but we haven't worked on a solution for this yet. Commented Sep 15, 2023 at 13:45

1 Answer 1

0
  1. You should try to put the same version of your local node with the command node -v

Get the local version of node.js

  1. Set up the same local node version of node in AWS Amplify
    • Click on your app in amplify
    • At the right side click in Build settings
    • Click on edit in Build image settings section
    • Add package version of node add package version of node
  2. Try again to redeploy

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.