cloudformation-cli icon indicating copy to clipboard operation
cloudformation-cli copied to clipboard

Profile (False) not found

Open jkruse14 opened this issue 1 year ago • 1 comments

When running cfn package, I am getting the following error

[2024-05-01T11:30:50Z] DEBUG    - Running package: Namespace(version=False, subparser_name='package', command=<function package at 0x7f7646575a20>, verbose=0)
[2024-05-01T11:30:50Z] DEBUG    - Root directory: /home/runner/work/db-aws-cloudformation-guard/db-aws-cloudformation-guard/hook
[2024-05-01T11:30:50Z] DEBUG    - Loading project file '/home/runner/work/db-aws-cloudformation-guard/db-aws-cloudformation-guard/hook/.rpdk-config'
[2024-05-01T11:30:50Z] INFO     - Validating your hook specification...
[2024-05-01T11:30:50Z] DEBUG    - Rewriting refs in '<BASE>' (file:///home/runner/work/db-aws-cloudformation-guard/db-aws-cloudformation-guard/hook/myCompany-cloudformation-guard.json)
[2024-05-01T11:30:50Z] DEBUG    - inputs not found. Not writing to package.
[2024-05-01T11:30:50Z] DEBUG    - Hook schema target names: {'AWS::S3::BucketPolicy', 'AWS::S3::Bucket'}
[2024-05-01T11:30:50Z] DEBUG    - Unhandled exception
Traceback (most recent call last):
  File "/home/runner/.local/lib/python3.10/site-packages/rpdk/core/cli.py", line 105, in main
    args.command(args)
  File "/home/runner/.local/lib/python3.10/site-packages/rpdk/core/package.py", line 15, in package
    project.submit(
  File "/home/runner/.local/lib/python3.10/site-packages/rpdk/core/project.py", line 648, in submit
    self._add_hooks_content_to_zip(
  File "/home/runner/.local/lib/python3.10/site-packages/rpdk/core/project.py", line 715, in _add_hooks_content_to_zip
    else self._load_target_info(
  File "/home/runner/.local/lib/python3.10/site-packages/rpdk/core/project.py", line 1233, in _load_target_info
    session = create_sdk_session(region_name, profile_name)
  File "/home/runner/.local/lib/python3.10/site-packages/rpdk/core/boto_helpers.py", line 24, in create_sdk_session
    session = Boto3Session(profile_name=profile_name, region_name=region_name)
  File "/home/runner/.local/lib/python3.10/site-packages/boto3/session.py", line 90, in __init__
    self._setup_loader()
  File "/home/runner/.local/lib/python3.10/site-packages/boto3/session.py", line 131, in _setup_loader
    self._loader = self._session.get_component('data_loader')
  File "/home/runner/.local/lib/python3.10/site-packages/botocore/session.py", line 802, in get_component
    return self._components.get_component(name)
  File "/home/runner/.local/lib/python3.10/site-packages/botocore/session.py", line 1140, in get_component
    self._components[name] = factory()
  File "/home/runner/.local/lib/python3.10/site-packages/botocore/session.py", line 199, in <lambda>
    lambda: create_loader(self.get_config_variable('data_path')),
  File "/home/runner/.local/lib/python3.10/site-packages/botocore/session.py", line 323, in get_config_variable
    return self.get_component('config_store').get_config_variable(
  File "/home/runner/.local/lib/python3.10/site-packages/botocore/configprovider.py", line 465, in get_config_variable
    return provider.provide()
  File "/home/runner/.local/lib/python3.10/site-packages/botocore/configprovider.py", line 671, in provide
    value = provider.provide()
  File "/home/runner/.local/lib/python3.10/site-packages/botocore/configprovider.py", line 761, in provide
    scoped_config = self._session.get_scoped_config()
  File "/home/runner/.local/lib/python3.10/site-packages/botocore/session.py", line 422, in get_scoped_config
    raise ProfileNotFound(profile=profile_name)
botocore.exceptions.ProfileNotFound: The config profile (False) could not be found

my rpdk config is:

{
    "artifact_type": "HOOK",
    "typeName": "myCompany::CloudFormation::Guard",
    "language": "java",
    "runtime": "java17",
    "entrypoint": "com.myCompany.cloudformation.guard.HookHandlerWrapper::handleRequest",
    "testEntrypoint": "com.myCompany.cloudformation.guard.HookHandlerWrapper::testEntrypoint",
    "settings": {
        "version": false,
        "subparser_name": null,
        "verbose": 0,
        "force": false,
        "type_name": null,
        "artifact_type": null,
        "endpoint_url": null,
        "region": null,
        "target_schemas": [],
        "profile": "default",
        "namespace": [
            "com",
            "myCompany",
            "cloudformation",
            "guard"
        ],
        "codegen_template_path": "default",
        "protocolVersion": "2.0.0"
    },
    "executableEntrypoint": "com.myCompany.cloudformation.guard.HookHandlerWrapperExecutable"
}

I have profile set to default and I set AWS_PROFRILE to default in my deploy script. What Profile is it looking for?

jkruse14 avatar May 01 '24 11:05 jkruse14

This is running in GitHub Actions, so some extra details

  • AWS credentials are set with aws-actions/configure-aws-credentials
  • cfn-cli is installed with:
- name: Install cfn cli
      run: |
        pip install cloudformation-cli cloudformation-cli-java-plugin
  • cfn package is run by
    - name: cfn package
      id: cfn-package
      working-directory: "./hook"
      shell: bash
      run: |
        AWS_PROFILE="default"
        ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text)
        cfn generate
        cfn package
        date=$(date '+%Y-%m-%d-%H-%M-%S')
        echo "uploading artifact to s3://my-artifacts-bucket/myCompany-cloudformation-guard-$date.zip"
        aws s3 cp ./myCompany-cloudformation-guard.zip s3://my-artifacts-bucket/myCompany-cloudformation-guard-$date.zip
        echo "artifact_name=myCompany-cloudformation-guard-$date.zip" >> $GITHUB_OUTPUT

jkruse14 avatar May 01 '24 13:05 jkruse14