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

Can't get backend deployment work native amplify cli

Open OperationalFallacy opened this issue 11 months ago • 4 comments

Before opening, please confirm:

Amplify Hosting feature

Deployments

Is your feature request related to a problem? Please describe:

version: 1
applications:
  - appRoot: xxx-website
    backend:
      phases:
        install:
          commands:
            - pwd
            - cd ../xxx-api
            - node --version
            - nvm use 18.17.0 || true
            - node --version
            - yarn global add tsc-alias typescript tsc
        build:
          commands:
            - yum install jq -y
            - pwd
            - cd ../xxx-api
            - which envCache
            - envCache --get stackInfo
            - export STACKINFO="$(envCache --get stackInfo)"
            - echo $STACKINFO
            - env
            - if [ "${USER_BRANCH}" = "dev" ]; then envCache --set stackInfo "$(amplify env get --json --name dev)"; fi
            - if [ "${USER_BRANCH}" = "prod" ]; then envCache --set stackInfo "$(amplify env get --json --name prod)"; fi
            - yarn install --production
            - export aid=$(envCache --get stackInfo | jq '.AmplifyAppId')
            - amplify --version
            - amplify status -v
            - amplify pull --appId ${aid} --envName ${USER_BRANCH}
            - amplify env list
            # - cat $(which amplifyPush) || true
            - amplify function build -y
            - amplify status
            - amplify push
            # - amplify push -y
            # - amplifyPush --simple
            - echo 'Build and push completed...'

Describe how you'd like this feature to work

I can't use amplifyPush --simple because it's not building and updating functions, probably because I've used some custom scripting. It works though in local dev environment.

And I can't get deployments with "amplify push" work in the cicd because it keeps failing with "Amplify backend project files detected within this folder" at amplify pull command...

2024-02-28T21:48:58.930Z [INFO]: 🛑 No Amplify backend project files detected within this folder.
2024-02-28T21:48:58.930Z [INFO]: Resolution:
                                 Either initialize a new Amplify project or pull an existing project.
                                 - "amplify init" to initialize a new Amplify project
                                 - "amplify pull <app-id>" to pull your existing Amplify project. Find the <app-id> in the AWS Console or Amplify Studio.
                                 Learn more at: https://docs.amplify.aws/cli/project/troubleshooting/

I need help figuring out what's going on. given that amplify status works - even though it says creating everything from scratch - why checking out env is such a pain?

OperationalFallacy avatar Feb 28 '24 21:02 OperationalFallacy

This has been identified as a feature request. If this feature is important to you, we strongly encourage you to give a 👍 reaction on the request. This helps us prioritize new features most important to you. Thank you!

github-actions[bot] avatar Feb 28 '24 21:02 github-actions[bot]

@OperationalFallacy 👋 , thanks for reaching out. Does running amplify push -y throw a similar error? Can you try including a pwd command before running the push to analyze the path? Also, can you share your Amplify app id?

For better assistance, I am going to transfer this over to the amplify-cli repository.

Jay2113 avatar Mar 04 '24 16:03 Jay2113

Here's app-id for dev: d2bgfp3zb4o7c8

OperationalFallacy avatar Mar 04 '24 16:03 OperationalFallacy

Hey @OperationalFallacy, thank you for providing the app-id. On diving into the logs it appears the issue is occurring on the amplify status -v. To mitigate the issue i would suggest moving the command to after the pull command. Additionally, noticed the pull command does not have a -y which may cause the cli to prompt for the profile selection.

ykethan avatar Mar 08 '24 21:03 ykethan

Closing the issue due to inactivity. Do reach out to us if you require any assistance.

ykethan avatar May 03 '24 15:05 ykethan

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.

github-actions[bot] avatar May 03 '24 15:05 github-actions[bot]