Ionic-cli: Ionic Pro problem setting up SSH key

Created on 20 Sep 2017  Â·  13Comments  Â·  Source: ionic-team/ionic-cli

I think the best way to describe the issue is showing the command trace of ionic ssh setup:

➜  mrkite-app git:(master) ionic ssh setup --verbose
[DEBUG] CLI flags: { interactive: true, confirm: false }
[DEBUG] { cwd: '/Users/marcosdd/projects/mrkite/mrkite-app', local: false, binPath:
        '/usr/local/lib/node_modules/ionic/bin/ionic', libPath: '/usr/local/lib/node_modules/ionic/dist/index.js' }
[DEBUG] Daemon found (pid: 944)
[INFO] Looks like you haven't configured your SSH settings yet.

? How would you like to connect to Ionic Pro? Use an existing SSH key pair
> ionic ssh add

? Enter the location to your public key file to upload to Ionic: /Users/marcosdd/.ssh/key-mdiniz.pub
Request: POST https://api.ionic.io/users/25165/sshkeys
Response: 404
Body:
{ message: '404: Not Found', link: null, type: 'NotFound' }
bug

Most helpful comment

@marcosdd Can you try logging in again?

All 13 comments

@marcosdd Did you do ionic link or ionic start in Ionic Pro yet? Your CLI is still using the old API URL (api.ionic.io).

You'll need to configure your CLI to use Ionic Pro (this happens automatically with --pro-id):

ionic config set -g backend pro

@dwieeb thx for the feedback. The backend was already set to pro:

➜  mrkite-app git:(master) ionic config set -g backend pro
[INFO] backend is already set to "pro".
➜  mrkite-app git:(master) ionic link --pro-id ******** (is it safe to expose the app id?)

? App ID 6e14b2fe already exists in project config. Would you like to link a different app? Yes
> ionic ssh setup
[INFO] Looks like you haven't configured your SSH settings yet.

? How would you like to connect to Ionic Pro? Use an existing SSH key pair
> ionic ssh add

? Enter the location to your public key file to upload to Ionic: /Users/marcosdd/.ssh/key-mdiniz.pub
Request: POST https://api.ionic.io/users/25165/sshkeys
Response: 404
Body:
{ message: '404: Not Found', link: null, type: 'NotFound' }

I'm gonna mark this as a bug, even though most people are unaffected. It seems to happen when the backend is pro but the rest of the config was unchanged.

I've committed a fix to _compute_ the URLs from the config, instead of relying on the config values themselves.

Your workaround today is:

ionic config set -g backend pro

Or, to switch back to cloud:

ionic config set -g backend legacy

Sorry about that! This will be fixed soon.

@dwieeb No problem, thanks for the quick reply!

Using the workaround, now I'm getting a 401 Invalid Token:

? How would you like to connect to Ionic Pro? Use an existing SSH key pair
> ionic ssh add

? Enter the location to your public key file to upload to Ionic: /Users/marcosdd/.ssh/key-mdiniz.pub
Request: POST https://api.ionicjs.com/users/25165/sshkeys
Response: 401
Body:
{ message: 'Invalid Token', link: null, type: 'Unauthorized' }

Am I missing something?

@marcosdd Can you try logging in again?

@dwieeb yep, nailed it! thank you very much for the support! :)

@marcosdd Also please test the new CLI: 3.11.0 which just came out. This shouldn't be an issue for anyone anymore.

Had this issue too, just had to re-login

Wow. I'm having the same problem but the above doesn't work for me. I have deleted the ionic folder with the SSH file and recreated the SSH file. I then went through the above steps. Still not working.

What I've noticed is an old work email is displayed at the end of the SSH file content string, but I'm logged in using my personal email. I can't see where my old work email could be deleted/removed/changed/updated.

@onlinemoose You could start fresh by also removing the global CLI config file at ~/.ionic/config.json.

either relogin or change it yo legacy and then to pro again
Your workaround today is:

ionic config set -g backend pro
Or, to switch back to cloud:

ionic config set -g backend legacy

I coudnt resolve it! Someone else have it?

I've tried so many things, but I cant find mor information about it.

@jecorrales Did you try this?

ionic config set -g backend pro
ionic login

If that doesn't help, please create a new issue and fill out the issue template.

Was this page helpful?
0 / 5 - 0 ratings