Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AWS Amplify CLI Headless mode opening browser window to capture token - CI/CD #13362

Closed
2 tasks done
rohit3d2003 opened this issue Oct 21, 2023 · 4 comments
Closed
2 tasks done
Labels
headless Headless mode for CI/CD pending-triage Issue is pending triage

Comments

@rohit3d2003
Copy link

rohit3d2003 commented Oct 21, 2023

How did you install the Amplify CLI?

npm

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

No response

Amplify CLI Version

5.3.11

What operating system are you using?

Mac

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

No

Describe the bug

I am using CodeMagic to automate build and deployment of iOS app which is using amplify backend. In order to achieve CI/CD, I have followed below steps:

  1. Install amplify using 'npm install -g @aws-amplify/cli'
  2. Pull environment specific configuration in a headless mode using below script
set -e
IFS='|'

AWSCLOUDFORMATIONCONFIG="{\
\"configLevel\":\"project\",\
\"useProfile\":false,\
\"profileName\":\"default\",\
\"accessKeyId\":$AWS_ACCESS_KEY_ID,\
\"secretAccessKey\":$AWS_SECRET_ACCESS_KEY,\
\"region\":\"us-east-1\"\
}"

PROVIDERS="{\
\"awscloudformation\":$AWSCLOUDFORMATIONCONFIG\
}"

AMPLIFY="{\
\"projectName\":$PROJECT_NAME,\
\"appId\":$AMPLIFY_APP_ID,\
\"envName\":\"dev\",\
\"defaultEditor\":\"code\"\
}"

amplify pull \
--amplify $AMPLIFY \
--providers $PROVIDERS \
--yes

Issue: Unfortunately in the headless mode, CLI is opening a browser window and stuck on someone clicking 'yes' or 'Copy CLI Key' vs automatically doing it.

Expected behavior

Token automatically downloaded in headless mode vs asking for a user interactive action to support CI/CD

Reproduction steps

  1. On any new machine, install amplify and run above mentioned script to see browser window coming up

Project Identifier

No response

Log output

Put your logs below this line

Additional information

No response

Before submitting, please confirm:

  • I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
  • I have removed any sensitive information from my code snippets and submission.
@rohit3d2003 rohit3d2003 added the pending-triage Issue is pending triage label Oct 21, 2023
@ykethan
Copy link
Member

ykethan commented Oct 23, 2023

Hey @rohit3d2003, thank you for reaching out. could you try utilizing the following without the set -e IFS='|'

#!/bin/sh

AMPLIFY_APP_ID="<app-id>"

AMPLIFY="{\
\"projectName\":\"headlesstest\",\
\"appId\":\"$AMPLIFY_APP_ID\",\
\"envName\":\"dev\",\
\"defaultEditor\":\"vscode\"\
}"

PROVIDERS="{\
\"awscloudformation\":{\
\"configLevel\":\"project\",\
\"useProfile\":false,\
\"profileName\":\"default\",\
\"accessKeyId\":\"<ID>\",\
\"secretAccessKey\":\"<key>\",\
\"region\":\"us-east-1\"\
}\
}"

amplify pull \
  --providers "$PROVIDERS" \
  --amplify "$AMPLIFY" \
  --yes

@ykethan ykethan added pending-response Issue is pending response from the issue author headless Headless mode for CI/CD labels Oct 23, 2023
@rohit3d2003
Copy link
Author

This worked. Wondering what changed in the above

@github-actions github-actions bot removed the pending-response Issue is pending response from the issue author label Oct 23, 2023
@ykethan
Copy link
Member

ykethan commented Oct 24, 2023

@rohit3d2003 believe the issue was caused by the escape characters being utilized such as access credentials and application.
Additionally, I will be closing the issue for now. please feel free on reaching out to us again.

@ykethan ykethan closed this as not planned Won't fix, can't repro, duplicate, stale Oct 24, 2023
@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

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.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
headless Headless mode for CI/CD pending-triage Issue is pending triage
Projects
None yet
Development

No branches or pull requests

2 participants