Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AWS CodeBuild Error #2221

Open
sidAtHoumm opened this issue Jun 14, 2021 · 0 comments
Open

AWS CodeBuild Error #2221

sidAtHoumm opened this issue Jun 14, 2021 · 0 comments

Comments

@sidAtHoumm
Copy link

Hi,
Am trying to automate the build process for the Deployment of a Flask Project using Zappa to AWS. The desired behaviour is that when a user commits code to a branch, the code should be deployed.

Have created a pipeline in AWS to deploy the code.

Following is the BuildSpec
version: 0.2

phases:
install:
commands:
- virtualenv venv
- . venv/bin/activate
- pip install -r requirements.txt
pre_build:
commands:
# - if [ ! -v STAGE ]; then echo stage not set; exit 1; fi
# - zappa manage --no-color $STAGE "collectstatic --noinput"
build:
commands:
- echo Build started on date
- echo Building and running tests
# - zappa update --disable_progress $STAGE
post_build:
commands:
- if [ $CODEBUILD_BUILD_SUCCEEDING = 1 ]; then echo Build completed on date; echo Starting deployment; zappa update dev; else echo Build failed ignoring deployment; fi
- echo Deployment completed

The Build gets successfully pulled from Github, but during the application build stage, the following errors are resulting when "zappa update dev" is being called. In addition, i have also setup an EC2 Server through which I usually deploy from. In that server I HAVE NOT created any Profile for AWS. Just Wanted to understand if the build spec or any other setting is missing. Havent really found any guide for integration of Zappa with CodePipeline.

_Traceback (most recent call last):
192 | File "/codebuild/output/src244337581/src/venv/lib/python3.8/site-packages/zappa/cli.py", line 2778, in handle
193 | sys.exit(cli.handle())
194 | File "/codebuild/output/src244337581/src/venv/lib/python3.8/site-packages/zappa/cli.py", line 512, in handle
195 | self.dispatch_command(self.command, stage)
196 | File "/codebuild/output/src244337581/src/venv/lib/python3.8/site-packages/zappa/cli.py", line 538, in dispatch_command
197 | self.load_settings(self.vargs.get('settings_file'))
198 | File "/codebuild/output/src244337581/src/venv/lib/python3.8/site-packages/zappa/cli.py", line 2116, in load_settings
199 | self.zappa = Zappa( boto_session=session,
200 | File "/codebuild/output/src244337581/src/venv/lib/python3.8/site-packages/zappa/core.py", line 306, in init
201 | self.load_credentials(boto_session, profile_name)
202 | File "/codebuild/output/src244337581/src/venv/lib/python3.8/site-packages/zappa/core.py", line 3187, in load_credentials
203 | self.boto_session = boto3.Session(profile_name=profile_name, region_name=self.aws_region)
204 | File "/codebuild/output/src244337581/src/venv/lib/python3.8/site-packages/boto3/session.py", line 80, in init
205 | self._setup_loader()
206 | File "/codebuild/output/src244337581/src/venv/lib/python3.8/site-packages/boto3/session.py", line 120, in _setup_loader
207 | self._loader = self._session.get_component('data_loader')
208 | File "/codebuild/output/src244337581/src/venv/lib/python3.8/site-packages/botocore/session.py", line 698, in get_component
209 | return self._components.get_component(name)
210 | File "/codebuild/output/src244337581/src/venv/lib/python3.8/site-packages/botocore/session.py", line 937, in get_component
211 | self._components[name] = factory()
212 | File "/codebuild/output/src244337581/src/venv/lib/python3.8/site-packages/botocore/session.py", line 158, in <lambda>
213 | lambda: create_loader(self.get_config_variable('data_path')))
214 | File "/codebuild/output/src244337581/src/venv/lib/python3.8/site-packages/botocore/session.py", line 251, in get_config_variable
215 | return self.get_component('config_store').get_config_variable(
216 | File "/codebuild/output/src244337581/src/venv/lib/python3.8/site-packages/botocore/configprovider.py", line 313, in get_config_variable
217 | return provider.provide()
218 | File "/codebuild/output/src244337581/src/venv/lib/python3.8/site-packages/botocore/configprovider.py", line 410, in provide
219 | value = provider.provide()
220 | File "/codebuild/output/src244337581/src/venv/lib/python3.8/site-packages/botocore/configprovider.py", line 471, in provide
221 | scoped_config = self.session.get_scoped_config()
222 | File "/codebuild/output/src244337581/src/venv/lib/python3.8/site-packages/botocore/session.py", line 351, in get_scoped_config
223 | raise ProfileNotFound(profile=profile_name)
224 | botocore.exceptions.ProfileNotFound: The config profile (default) could not be found
225 |  
226 | [Container] 2021/06/14 13:35:47 Command did not exit successfully if [ $CODEBUILD_BUILD_SUCCEEDING = 1 ]; then echo Build completed on date; echo Starting deployment; zappa update dev; else echo Build failed ignoring deployment; fi exit status 255
227 | [Container] 2021/06/14 13:35:47 Phase complete: POST_BUILD State: FAILED
228 | [Container] 2021/06/14 13:35:47 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: if [ $CODEBUILD_BUILD_SUCCEEDING = 1 ]; then echo Build completed on date; echo Starting deployment; zappa update dev; else echo Build failed ignoring deployment; fi. Reason: exit status 255
229

Your Environment

  • Zappa version used: latest

  • Operating System and Python version: Ubuntu

  • Your zappa_settings.json:
    "dev": {
    "app_function": "app.app",
    "profile_name": "default",
    "project_name": "analytics-platform",
    "runtime": "python3.7",
    "s3_bucket": "XXX-houm-dashboard-lambda",
    "aws_region": "us-east-2",
    "timeout_seconds": 900,
    "memory_size": 1024,
    "debug": false,
    "cors": true,
    "manage_roles": false,
    "role_name": "XXX-dashbboard--lambda",
    "role_arn": "arn:aws:iam::XXXXXX:role/XXX-XXX-dashbboard--lambda",
    "environment_variables": {
    "SECRET_KEY": "XXXXXXXXX",
    "region": "us-east-2",
    "db_host": "XXXXXX",
    "port": "3306",
    "db": "XXXX_anaylytics",
    "user": "admin",
    "password": "XXXXXXXX"
    }

    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant