Miserlou / Zappa

Serverless Python
https://blog.zappa.io/
MIT License
11.89k stars 1.2k forks source link

botocore.exceptions.ProfileNotFound: The config profile (default) could not be found #2131

Open arshyasharifian opened 4 years ago

arshyasharifian commented 4 years ago

This is the error code:

[error]Process completed with exit code 255.

I am trying to run a CI/CD pipline through git actions.

workflow starts here: ` name: CI

on: push: branches: [ master ] pull_request: branches: [ master ]

jobs: build: runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python
  uses: actions/setup-python@v2
  with:
    python-version: '3.7'
- name: Configure AWS credentials from Production account
  uses: aws-actions/configure-aws-credentials@v1
  with:
    aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
    aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
    aws-region: us-east-1
    profile_name: default
    project_name: test-dep
    runtime: python3.7
    s3_bucket: arysb
- name: Run a multi-line script
  run: |
     echo "::add-path::/investbot/.aws"
     #curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
     #aws configure --profile arshyasharifian
     python -m pip install --upgrade pip 
     pip install -r requirements.txt
     zappa deploy dev`

Ideally, this would deploy the updated application in the AWS Lambda serverless instance.

requirements.txt: argcomplete==1.11.1 boto3==1.14.13 botocore==1.17.13 certifi==2020.6.20 cfn-flip==1.2.3 chardet==3.0.4 click==7.1.2 docutils==0.15.2 durationpy==0.5 Flask==1.0 future==0.18.2 hjson==3.0.1 idna==2.10 importlib-metadata==1.7.0 itsdangerous==1.1.0 Jinja2==2.11.2 jmespath==0.10.0 kappa==0.6.0 MarkupSafe==1.1.1 pip-tools==5.2.1 placebo==0.9.0 python-dateutil==2.6.1 python-slugify==4.0.0 PyYAML==5.3.1 requests==2.24.0 s3transfer==0.3.3 six==1.15.0 text-unidecode==1.3 toml==0.10.1 tqdm==4.47.0 troposphere==2.6.1 urllib3==1.25.9 Werkzeug==0.16.1 wsgi-request-logger==0.4.6 zappa==0.51.0 zipp==3.1.0

my zappa_settings.json, but I am not sure if the workflow sees this or not: { "dev": { "app_function": "main.app", "aws_region": "us-east-1", "profile_name": "default", "project_name": "test-dep", "runtime": "python3.7", "s3_bucket": "arysb" } }

piraka9011 commented 4 years ago

Did you try the suggestion here? https://github.com/Miserlou/Zappa/issues/1736

piraka9011 commented 4 years ago

FWIW Here's my deployment step that worked

- name: Deploy dev
   run: |
     pip install virtualenv
     virtualenv my-deploy
     source my-deploy/bin/activate
     pip install -r requirements.txt zappa
     zappa update dev
  env:
    AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
    AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
    AWS_DEFAULT_REGION: us-west-2

and removed the profile_name from the zappa_settings.json

julianf19 commented 2 years ago

Same Happened to me with boto3.session.Session(profile_name="default, region_name..... It only worked when removing profile_name: boto3.session.Session(region_name.....