moto icon indicating copy to clipboard operation
moto copied to clipboard

The config profile (default) could not be found

Open iffystiffy opened this issue 3 years ago • 9 comments

I am getting this error every time I try to mock the aws_credentials from the tutorial, I keep getting the "botocore.exceptions.ProfileNotFound: The config profile (adfs) could not be found" error. I reinstalled moto a few times and I am not sure why I keep getting this error and its hindering my progression. image

iffystiffy avatar Sep 13 '22 17:09 iffystiffy

image Here is the example code I tried to follow from the setup document. I tried even doing a os.enviro['AWS_PROFILE'] = 'adfs' with no luck

iffystiffy avatar Sep 13 '22 17:09 iffystiffy

Hi @iffystiffy, that looks like an error coming from boto3 itself. If you remove the with mock_s3 part, it will still throw an error if the profile does not exist.

Note that the profile does not need to be mocked for Moto to work. Setting the fake credentials as environment variables is enough to ensure the test will never connect to to AWS.. (Also, as far as I know, our documentation never mentions mocking a profile - but please correct me if I'm wrong.)

bblommers avatar Sep 14 '22 21:09 bblommers

Right now I reinstalled boto3 botocore from 1.27.68 to 1.27.71 and I am still getting the "botocore.exceptions.ProfileNotFound: The config profile (adfs) could not be found" error. I am not sure where the 'adfs' profile is created because all the packages are pretty much brand new.

iffystiffy avatar Sep 15 '22 14:09 iffystiffy

If you haven't created the adfs profile, and you don't want to, you can just create the boto3-client without specifying a profile: yield boto3.client("s3", region_name="us-east-1")

bblommers avatar Sep 15 '22 14:09 bblommers

I tried yield boto3.client("s3", region_name="us-east-1") and its still giving me the same adfs error. I did a complete copy and paste of the tutorial code posted on the moto website and the same error

iffystiffy avatar Sep 15 '22 15:09 iffystiffy

Did you also remove the os.environ["AWS_PROFILE"] = "asdf"? That part is definitely not on the official website (docs.getmoto.org)

bblommers avatar Sep 15 '22 15:09 bblommers

yeah I got rid of os.environ["AWS_PROFILE"] = "asdf" as well with no luck.

iffystiffy avatar Sep 15 '22 16:09 iffystiffy

I was following this tutorial https://www.learnaws.org/2020/12/01/test-aws-code/ word for word

iffystiffy avatar Sep 15 '22 16:09 iffystiffy

Did you configure AWS previously? Whatever profile is missing, must be configured somewhere.

Did you try running the test without Moto? I'm fairly certain that the error will still occur then, as it sounds like a botocore configuration issue.

bblommers avatar Sep 15 '22 16:09 bblommers