Aws-toolkit-jetbrains: "Failed to refresh process-based credentials." when connecting to AWS

Created on 5 Feb 2020  路  3Comments  路  Source: aws/aws-toolkit-jetbrains

Describe the bug
I cannot use my existing AWS profile inside AWS toolkit, as i receive the error Failed to refresh process-based credentials.

I use a custom process (an in-house Python cli called Wrench) to obtain time-limited credentials for a IAM role when connecting to AWS. This works fine on the command line, but not inside PyCharm. I have used this process for years now, so the problem is not there.

I install Wrench in a pyenv Python 3.6 environment. My system Python is 3.7. I recently had a very similar issue where it wasn't possible for the aws cli to get credentials from the custom process because I had pip install awscli into Python 3.7. That's fixed now, and $ aws sts get-caller-identity correctly gets the credentials from the custom process.

I am able to connect to AWS using a profile which does not use the custom process.

I'm unable to see any relevant info in the PyCharm log file. Is there somewhere else I can look to debug this?

Expected behavior
I am able to connect to AWS using the same profile in PyCharm that I use on the shell.

Screenshots
Captura de Tela 2020-02-05 a虁s 10 45 11

Your Environment

  • OS: macOs Catalina 10.15.3
  • JetBrains' Product: PyCharm
  • JetBrains' Product Version: 2019.3
  • Toolkit Version: 1.10-193
  • SAM CLI Version: Not installed.
  • JVM/Python Version: JVM 11.0.5 (I think). System Python is Homebrew 3.7, AWS CLI and Wrench installed into virtualenvs created from pyenv 3.6
auth bug

Most helpful comment

Sadly the log statement we need to debug this has not been released to stable channel yet. If I had to take a shot in the dark, I would guess environment variables are causing issues since Mac apps launched from gui do not inherit them.

Things to try

  1. Try to launch the ide from a terminal
  2. Wrap the credentials process command in a shell script so it runs in a terminal environment and has env vars / .bashrc info

All 3 comments

Sadly the log statement we need to debug this has not been released to stable channel yet. If I had to take a shot in the dark, I would guess environment variables are causing issues since Mac apps launched from gui do not inherit them.

Things to try

  1. Try to launch the ide from a terminal
  2. Wrap the credentials process command in a shell script so it runs in a terminal environment and has env vars / .bashrc info

Thanks for the quick response!

The problem is definitely the environment that PyCharm launches in - when I launch it from the terminal I'm able to connect using any of the AWS profiles I have setup.

Thanks for the help @abrooksv

For what it's worth - I had this exact same problem, and

  1. Enabling shell scripts in the Toolbox https://blog.jetbrains.com/blog/2018/08/23/toolbox-app-1-11-whats-new/ ,
  2. And launching from CLI ($ idea)

helped solve this.

Was this page helpful?
0 / 5 - 0 ratings