Miserlou / Zappa

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

AWS CodeBuild Error #2221

Open sidAtHoumm opened 3 years ago

sidAtHoumm commented 3 years ago

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:

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_BUILDSUCCEEDING = 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