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

Amplify Init asks for code. #13238

Closed
qwikag opened this issue Sep 19, 2023 · 8 comments
Closed

Amplify Init asks for code. #13238

qwikag opened this issue Sep 19, 2023 · 8 comments
Labels
pending-response Issue is pending response from the issue author pending-triage Issue is pending triage transferred This issue was transferred from another Amplify project

Comments

@qwikag
Copy link

qwikag commented Sep 19, 2023

this screen is offered, but there is no code to compare it to:
image

@reesscot reesscot transferred this issue from aws-amplify/docs Sep 19, 2023
@reesscot
Copy link

Transferring to CLI, as this issues is related to amplify init

@josefaidt
Copy link
Contributor

Hey @qwikag 👋 where are you seeing this?

@josefaidt josefaidt added pending-response Issue is pending response from the issue author pending-triage Issue is pending triage transferred This issue was transferred from another Amplify project labels Sep 19, 2023
@qwikag
Copy link
Author

qwikag commented Sep 19, 2023

@josefaidt

2 parts to my response,

  1. I answer your question.

  2. the fix that is required.

Because of all of the issues I have been having, I started again from the beginning.
Followed the guide to the letter.
and ran into all of the same problems with CLI Auth, setup of APIs and App Auth, and Lambda access to Graphql.

Where did I see it this sccreenshot:
When using the Config file setup you advised in that other ticket 4488#issuecomment-1607961390

[profile profile1]
sso_session=mysso
sso_account_id=0123456789435
sso_role_name=AdminAmplify
region=ap-southeast-2
output=json
credential_process=aws sso login --profile profile1

[sso-session mysso]
sso_start_url=https://domain.awsapps.com/start
sso_region=ap-southeast-2
sso_registration_scopes=sso:account:access

This is what the result looks like (which includes the screenshot I previously supplied and hence this answers your question:"

amplify init
Note: It is recommended to run this command from the root of your app directory
? Enter a name for the project test
The following configuration will be applied:

Project information
| Name: test
| Environment: dev
| Default editor: Visual Studio Code
| App type: javascript
| Javascript framework: none
| Source Directory Path: src
| Distribution Directory Path: dist
| Build Command: npm.cmd run-script build
| Start Command: npm.cmd run-script start

? Initialize the project with the above configuration? Yes
Using default provider awscloudformation
? Select the authentication method you want to use: AWS profile

For more information on AWS Profiles, see:
https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html

? Please choose the profile you want to use profile1
🛑 Failed to get profile credentials
Unexpected token A in JSON at position 0

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

Session Identifier: bbbbbbbb-eeee-4444-9999-1111aaaa2222

Hence not only did I get a browser screen prompt that is factually inaccurate but also it does not work.

@github-actions github-actions bot removed the pending-response Issue is pending response from the issue author label Sep 19, 2023
@qwikag
Copy link
Author

qwikag commented Sep 20, 2023

What is fundamentally missing is the info about having process-level environment variables.

If those are missing then the browser requests access, as per picture.

@qwikag
Copy link
Author

qwikag commented Sep 20, 2023

Hey @josefaidt ,
And if we follow the guide and do >amplify configure , it setups up the creds in the credentials file, which are completely useless.

It is just all over the place.

I plan to get my head into the cli code and see if I can add some value because I feel quite invested at this point.

And I want this (Amplify) to be a better place.

@josefaidt
Copy link
Contributor

Hey @qwikag apologies for the delay here. If you currently have AWS credentials set locally you do not need to run amplify configure, and can instead bypass this step in favor of selecting an existing AWS profile during amplify init

In the original screenshot it appears to have attempted to authorize with Amplify Studio, which is the default behavior when Amplify Studio is enabled for an Amplify application.

From the previous error log:

? Please choose the profile you want to use profile1
🛑 Failed to get profile credentials
Unexpected token A in JSON at position 0

Can you check the ~/.amplify/admin/config.json file for a leftover record for this App ID? It is possible there is a stray artifact in this file that is causing the CLI to attempt to authorize with Studio

@josefaidt josefaidt added the pending-response Issue is pending response from the issue author label Oct 3, 2023
@josefaidt
Copy link
Contributor

Closing due to inactivity

@josefaidt josefaidt closed this as not planned Won't fix, can't repro, duplicate, stale Feb 2, 2024
Copy link

github-actions bot commented Feb 2, 2024

⚠️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
pending-response Issue is pending response from the issue author pending-triage Issue is pending triage transferred This issue was transferred from another Amplify project
Projects
None yet
Development

No branches or pull requests

3 participants