Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Elastic Beanstalk - Command failed on instance.An unexpected error has occurred [ErrorCode: 0000000001]

First time I'm trying to deploy a django app to elastic beanstalk. The application uses django channels.

These are my config files:

option_settings:  
  aws:elasticbeanstalk:container:python:     
    WSGIPath: "dashboard/dashboard/wsgi.py"
  aws:elasticbeanstalk:application:environment:
    DJANGO_SETTINGS_MODULE: "dashboard/dashboard/settings.py"
    PYTHONPATH: /opt/python/current/app/dashboard:$PYTHONPATH

  aws:elbv2:listener:80:
    DefaultProcess: http
    ListenerEnabled: 'true'
    Protocol: HTTP
    Rules: ws
  aws:elbv2:listenerrule:ws:
    PathPatterns: /websockets/*
    Process: websocket
    Priority: 1
  aws:elasticbeanstalk:environment:process:http:
    Port: '80'
    Protocol: HTTP
  aws:elasticbeanstalk:environment:process:websocket:
    Port: '5000'
    Protocol: HTTP

container_commands:
  00_pip_upgrade:
    command: "source /opt/python/run/venv/bin/activate && pip install --upgrade pip"
    ignoreErrors: false
  01_migrate:
    command: "django-admin.py migrate"
    leader_only: true
  02_collectstatic:
    command: "django-admin.py collectstatic --noinput"
  03_wsgipass:
    command: 'echo "WSGIPassAuthorization On" >> ../wsgi.conf'

When I run eb create django-env I get the following logs:

Creating application version archive "app-200617_112710".
Uploading: [##################################################] 100% Done...
Environment details for: django-env
  Application name: dashboard
  Region: us-west-2
  Deployed Version: app-200617_112710
  Environment ID: e-rdgipdg4z3
  Platform: arn:aws:elasticbeanstalk:us-west-2::platform/Python 3.7 running on 64bit Amazon Linux 2/3.0.2
  Tier: WebServer-Standard-1.0
  CNAME: UNKNOWN
  Updated: 2020-06-17 10:27:48.898000+00:00
Printing Status:
2020-06-17 10:27:47    INFO    createEnvironment is starting.
2020-06-17 10:27:49    INFO    Using elasticbeanstalk-us-west-2-041741961231 as Amazon S3 storage bucket for environment data.
2020-06-17 10:28:10    INFO    Created security group named: sg-0942435ec637ad173
2020-06-17 10:28:25    INFO    Created load balancer named: awseb-e-r-AWSEBLoa-19UYXEUG5IA4F
2020-06-17 10:28:25    INFO    Created security group named: awseb-e-rdgipdg4z3-stack-AWSEBSecurityGroup-17RVV1ZT14855
2020-06-17 10:28:25    INFO    Created Auto Scaling launch configuration named: awseb-e-rdgipdg4z3-stack-AWSEBAutoScalingLaunchConfiguration-H5E4G2YJ3LEC
2020-06-17 10:29:30    INFO    Created Auto Scaling group named: awseb-e-rdgipdg4z3-stack-AWSEBAutoScalingGroup-1I2C273N6RN8S
2020-06-17 10:29:30    INFO    Waiting for EC2 instances to launch. This may take a few minutes.
2020-06-17 10:29:30    INFO    Created Auto Scaling group policy named: arn:aws:autoscaling:us-west-2:041741961231:scalingPolicy:8d4c8dcf-d77d-4d18-92d8-67f8a2c1cd9e:autoScalingGroupName/awseb-e-rdgipdg4z3-stack-AWSEBAutoScalingGroup-1I2C273N6RN8S:policyName/awseb-e-rdgipdg4z3-stack-AWSEBAutoScalingScaleDownPolicy-1JAUAII3SCELN
2020-06-17 10:29:30    INFO    Created Auto Scaling group policy named: arn:aws:autoscaling:us-west-2:041741961231:scalingPolicy:0c3d9c2c-bc65-44ed-8a22-2f9bef538ba7:autoScalingGroupName/awseb-e-rdgipdg4z3-stack-AWSEBAutoScalingGroup-1I2C273N6RN8S:policyName/awseb-e-rdgipdg4z3-stack-AWSEBAutoScalingScaleUpPolicy-XI8Z22SYWQKR
2020-06-17 10:29:30    INFO    Created CloudWatch alarm named: awseb-e-rdgipdg4z3-stack-AWSEBCloudwatchAlarmHigh-572C6W1QYGIC
2020-06-17 10:29:30    INFO    Created CloudWatch alarm named: awseb-e-rdgipdg4z3-stack-AWSEBCloudwatchAlarmLow-1RTNBIHPHISRO
2020-06-17 10:33:05    ERROR   [Instance: i-01576cfe5918af1c3] Command failed on instance. An unexpected error has occurred [ErrorCode: 0000000001].
2020-06-17 10:33:05    INFO    Command execution completed on all instances. Summary: [Successful: 0, Failed: 1].
2020-06-17 10:34:07    ERROR   Create environment operation is complete, but with errors. For more information, see troubleshooting documentation.

ERROR: ServiceError - Create environment operation is complete, but with errors. For more information, see troubleshooting documentation.

The error is extremely vague, and I have no clue as to what I'm doing wrong.

like image 591
Filipe Avatar asked Jun 17 '20 10:06

Filipe


1 Answers

I had a similar issue. I used psycopg2-binary instead of psycopg2 and created a new environment. The health status is now ok

like image 146
Solly Avatar answered Oct 21 '22 01:10

Solly