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 CLI: AWS Amplify Failed to communicate with the Amplify CLI [using Safari browser] #84

Closed
rajendrav5 opened this issue Jan 18, 2021 · 112 comments
Assignees

Comments

@rajendrav5
Copy link

This happens even after 15 trails.

@rajendrav5
Copy link
Author

while cloning a amplify backend app to local environment.

@hsspain
Copy link
Contributor

hsspain commented Jan 19, 2021

@rajendrav5 Can you provide the logs that show in your Console when logging in this way?

@hsspain hsspain added the pending-response An issue is pending response from the issue requestor label Jan 19, 2021
@kaustavghosh06
Copy link
Contributor

@rajendrav5 Are you using WSL, Cloud9 or CloudShell?

@kaustavghosh06 kaustavghosh06 changed the title AWS Amplify Failed to communicate with the Amplify CLI. You can try again by running: Amplify CLI: AWS Amplify Failed to communicate with the Amplify CLI. You can try again by running: Jan 20, 2021
@fpstidston
Copy link

This gets stuck on

amplify configure --appId XXX --envName staging
Opening link: https://us-east-2.admin.amplifyapp.com/admin/XXX/staging/verify/
⠴ Continue in browser to log in…

@hsspain
Copy link
Contributor

hsspain commented Jan 21, 2021

@fpstidston Are you using WSL, Cloud9 or CloudShell?

@fpstidston
Copy link

fpstidston commented Jan 21, 2021

@hsspain Please tell me how I can find out this information
--- Edit ---
No I'm not using those

@kaustavghosh06
Copy link
Contributor

@fpstidston Does your browser open up to - https://us-east-2.admin.amplifyapp.com/admin/XXX/staging/verify/ and were you able to login?

@fpstidston
Copy link

@kaustavghosh06 yes the browser opens up to that url, asks me if I'm sure I want to sign in, then a second after I click yes I get the error reported every time.

@kaustavghosh06
Copy link
Contributor

@fpstidston Which Browser are you using? Also, which OS are you using locally?

@fpstidston
Copy link

macOS 11 Safari 14

@kaustavghosh06
Copy link
Contributor

kaustavghosh06 commented Jan 21, 2021

Can you try opening the link into Chrome/Firefox and see if you can get by this error?

@fpstidston
Copy link

Chrome asks for user name and password instead of offering the 'yes' or 'no' log in options, and if I enter my AWS console credentials then it says they are incorrect

@kaustavghosh06
Copy link
Contributor

kaustavghosh06 commented Jan 21, 2021

@fpstidston You can learn here - https://docs.amplify.aws/console/adminui/access-management as to how you can add access and create a user for your Amplify Admin App. AWS creds won't work for login for the Admin app.

@fpstidston
Copy link

I am logged in now using Chrome, thanks @kaustavghosh06

@SilverLinings89
Copy link

I get this same error in the last days on WSL. It opens a browser with the right URL, I click yes and then it fails to communicate with the browser.
WSL on Windows 10 and Browser is Chrome.

@abhjaw
Copy link

abhjaw commented Jan 22, 2021

I am getting the same issue on Cloud9. Login to the URL in browser or in pre
admin:~/environment/todoapp (master) $ amplify configure --appId XXXXXX --envName staging
Opening link: https://us-east-1.admin.amplifyapp.com/admin/XXXXXX/staging/verify/
Continue in browser to log in...
After opening the link in browser (Chrome) it asks
Are you sure you want to login to the Amplify CLI?
After clicking on Yes it gives an error
Failed to communicate with the Amplify CLI

@SteeveGL
Copy link

There are any work around? Cannot pull the project even with the AWS access configured.

nodejs 15.x in Ubuntu 20.04 WSL
aws-amplify/cli v4.41.2

Admin UI in my Chrome (Windows) try to reach http://127.0.0.1:4242 but return error. The port is open as well.
I used cURL in the WSL console and that return error too.

It seems to be related to Amplify cli

@svenfinke
Copy link

I also do get the same error running Ubuntu in WSL2 under Windows 10. I execute the code in the Terminal under Ubuntu, which opens my Edge browser. After logging in and accepting the CLI login, I get "Failed to communicate with the Amplify CLI. You can try again by running: ..."

@jgroom33
Copy link

jgroom33 commented Jan 30, 2021

Windows 10 WSL 2

workaround:

  1. amplify pull --appId xxxx --env foo
  2. Inspect Network in the browser and grab the failed POST operation targeted at localhost:4242
  3. right click and copy as curl (bash)
  4. paste into the wsl terminal (possibly a firewall is blocking on the host)

Apparently, this operation is supposed to pass the tokens. Once they are captured, a pull should work.

@pwnreza
Copy link

pwnreza commented Jan 30, 2021

Windows 10 WSL 2

workaround:

  1. amplify pull --appId xxxx --env foo
  2. Inspect the browser and grab the POST operation targeted at localhost:4242
  3. copy as curl and paste into the wsl terminal (possibly a firewall is blocking on the host)

Apparently, this operation is supposed to pass the tokens. Once they are captured, a pull should work.

thx for the workaround. for ppl not being experts with curl. Need to use -H to set the appropriate Header and -d for the payload

curl -d '' -H "Content-Type: application/json" -X POST http://127.0.0.1:4242/amplify

@pcolmer
Copy link

pcolmer commented Feb 3, 2021

Can this issue please be reopened? There is clearly a problem here that needs to be investigated and fixed.

Thanks.

@kylekirkby
Copy link

Definitely still an issue.. @swaminator. This was working fine prior to any of the Admin UI updates.

@pcolmer
Copy link

pcolmer commented Feb 3, 2021

@hsspain

Can you provide the logs that show in your Console when logging in this way?

POST http://127.0.0.1:4242/amplifyadmin/ net::ERR_CONNECTION_REFUSED

This is with WSL 2 on Windows 10. I'm using the Chromium version of Edge as my browser.

@kylekirkby
Copy link

kylekirkby commented Feb 3, 2021

OK, so the workaround to fetch the tokens works with the following command providing the failed amplify pull command is still showing ⠹ Continue in browser to log in…. Run this command in a separate terminal:

curl -d '-------past in the payload from the failed fetch--------' -H "Content-Type: application/json" -X POST http://127.0.0.1:4242/amplifyadmin

@rraczae
Copy link

rraczae commented Feb 5, 2021

Still an issue, getting the same with a brand new app

@hectorcarrillostrata
Copy link

same issue

@renebrandel
Copy link
Contributor

Hi folks - we’ve just launched the Amplify CLI version 9.1.0, which addresses this issue. Now if the auto-login flow fails, you’ll be prompted to manually copy/paste a CLI login key into the Terminal.

  1. Copy CLI login key from your browser
  2. Paste into Terminal
  3. Success 🥳
CLI.Safari.Login.mp4

@renebrandel
Copy link
Contributor

Feel free to @-mention me to re-open if the update flow doesn't work for you. Don't forget to upgrade to the latest Amplify CLI version 9.1.0 by running amplify upgrade

@endymion
Copy link

What's the workaround for when the workaround fails?

I'm using 9.1.0, and I can't log in. I develop using a remote EC2 workstation through VS Code on my Mac. Previously, mapping port 4242 worked. That doesn't work anymore with 9.1.0.

But the workaround also does not work. The CLI says, "Confirm login in the browser or manually paste in your CLI login key:" But the browser shows the Amplify logo and nothing else. There is no form for obtaining a login key, as shown in the demo video from @renebrandel

This is a production, mission-critical app that I suddenly can't work on, so I'm going to have to file an AWS support request. But if anyone knows of any workaround for this new workaround failing, please let me know?

@renebrandel
Copy link
Contributor

hi @endymion - can you provide us your App ID and region? We're going to investigate this. (Ideally if you have a screen recording of the repro steps from your end; that'll be great!)

@endymion
Copy link

Oh, gosh, thanks! App ID: dt5zkln62kw1m region: us-east-1

I'll work on a recording...

@renebrandel
Copy link
Contributor

Thanks! Can you also provide your Support Case ID?

@renebrandel
Copy link
Contributor

(Feel free to email me directly at renbran at amazon dot com)

@totallytotallyamazing
Copy link

totallytotallyamazing commented Jul 20, 2022

I am using Mac Big Sir Version: 11.6, VS Code Version: 1.69.2 (Universal), and Chrome Version 103.0.5060.114 (Official Build) (x86_64) I have also tried this in the latest version of Safari and I keep getting this same error:

Failed to communicate with the Amplify CLI. You can try again by running:
amplify configure --appId dxxxxxxxxxxxxx --envName staging
Screen Shot 2022-07-19 at 10 05 04 PM

@qiubit
Copy link

qiubit commented Jul 20, 2022

worked for me on macOS 12.3 when I ran the command with sudo

@pgib
Copy link

pgib commented Jul 20, 2022

worked for me on macOS 12.3 when I ran the command with sudo

sudo should definitely not be required/advised to run the amplify CLI. Yikes.

@totallytotallyamazing
Copy link

@qiubit Thank you! Your suggestion just worked for me yet I'm afraid of what's next since there really is no good direction available for this very new product. Also I had to use the sudo command during the amplify CLI install as well but didn't think to try it for a simple pull command, especially within the root directory so thanks again!!! 👍
Also @pgib I totallytotally agree with you 😆

@orome
Copy link

orome commented Jul 20, 2022

My overall experience with Amplify has been that there are just certain things that simply do not work as described. I've managed to construct a workflow that functions, but that entailed about an extra month of work, running up against broken or nonfictional things, taking notes of how to avoid them or give up on having a feature that's described in the docs.

Ultimately this is down to Amazon's lazy approach to this. Amplify should have been a much better managed and more formally maintained and documented project. Given that it's not, there ought to have been a very clear waring right at the start.

@pgib
Copy link

pgib commented Jul 20, 2022

My overall experience with Amplify has been that there are just certain things that simply do not work as described. I've managed to construct a workflow that functions, but that entailed about an extra month of work, running up against broken or nonfictional things, taking notes of how to avoid them or give up on having a feature that's described in the docs.

Ultimately this is down to Amazon's lazy approach to this. Amplify should have been a much better managed and more formally maintained and documented project. Given that it's not, there ought to have been a very clear waring right at the start.

I ultimately lost faith in Amplify as a whole due to issues such as these. I opted to use the aws-amplify Javascript package for auth, and then I've paired that with Cognito that I setup with CDK. There are some good parts, but I don't trust something won't blow up or I'll get really stuck running into an issue where documentation is lacking or incorrect.

@totallytotallyamazing
Copy link

@orome do you regret using / learning it at this point? After learning React and Redux, etc about 2-3 years ago, I feel very comfortable with them at this point. The decision to learn Amplify was partially due to my current direction. That being said do you think perhaps there's a better backend cloud tech solution to consider?

@orome
Copy link

orome commented Jul 20, 2022

@totallytotallyamazing Amplify ate all the time I had to chose a solution for my current project, so I don't know about alternatives. Others here will know more (and I'd be interested in their thoughts).

For me at the moment, Amplify is just another term for tech debt.

(I will say though that so many parts of the React ecosystem are so terrible — Redux for example — that some aspects of Amplify are nothing short of miraculous — Amplify.API for example — at least the parts that actually work as described, at least for some basic scenarios.)

@ramyashreeshetty
Copy link

For brave browser, just close the brave shield for that site. 👍

THANKS FOR THE SOLUTION, I WAS DYINGGGGGG

@pres2300
Copy link

pres2300 commented Jul 8, 2023

@renebrandel I'm still having this issue running amplify 12.1.1 on macOS 13.4.1 (Apple Silicon) and Chrome web browser. At one point I noticed if I refresh the page that Amplify opens saying it couldn't communicate with the CLI it will give me a CLI login key. Manually pasting that into the CLI when prompted resulted in an error as well: Failed to authenticate with Amplify Studio: Provided token was invalid.

I've tried disabling ad blockers, DNS blockers, etc. and nothing seems to get through. Any suggestions as I seem to be hitting the same issue this ticket addressed?

EDIT: I was using amplify on us-west-2 if that helps. Let me know if there's any more info I can provide. This seemed like a great tool for my use case (solo dev building an app) but if these issues persist and I can't even get the example application running from this tutorial I'll probably move on relatively soon.

@victoriatomzik
Copy link

I have a DuckDuckGo Essentials Plugin installed on my Firefox Developer. Disabling the plugin for a moment to log in worked for me as a workaround.

@mederocc
Copy link

Where may I find the the Amplify login key? I'm trying to find it by looking at the options in the Amplify console. My terminal can interact with my browser because of current company limitations and such. So I need to find the key and manually paste it in.

@jimmytoan
Copy link

I tried all solutions above, nothing worked for me.

Macbook Pro M2, OS 14.2.1

@orome
Copy link

orome commented Apr 9, 2024

@Jacke-debug Switch to Heroku. Amplify is a disaster.

@orome
Copy link

orome commented Apr 9, 2024

@orome do you regret using / learning it at this point? After learning React and Redux, etc about 2-3 years ago, I feel very comfortable with them at this point. The decision to learn Amplify was partially due to my current direction. That being said do you think perhaps there's a better backend cloud tech solution to consider?

@totallytotallyamazing Heroku. I was able to do in a few days what I had failed and failed and failed again (and have still yet) to accomplish with Amplify over the course of months.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests