CodeDeploy Deployment Failed, Possibly Due to zaproxy Installation Causing Python Package Conflict

0

I encountered an issue with CodeDeploy where deployments are failing, and the error message is as follows: AfterInstall Failed Event details Error code ScriptFailed Script name shell/after.sh Message Script at specified location: shell/after.sh run as user ubuntu failed with exit code 1 Logs

LifecycleEvent - AfterInstall
Script - shell/after.sh
[stderr]Traceback (most recent call last):
[stderr] File "/usr/bin/aws", line 19, in <module>
[stderr] import awscli.clidriver
[stderr] File "/usr/lib/python3/dist-packages/awscli/clidriver.py", line 17, in <module>
[stderr] import botocore.session
[stderr] File "/usr/lib/python3/dist-packages/botocore/session.py", line 29, in <module>
[stderr] import botocore.credentials
[stderr] File "/usr/lib/python3/dist-packages/botocore/credentials.py", line 35, in <module>
[stderr] from botocore.config import Config
[stderr] File "/usr/lib/python3/dist-packages/botocore/config.py", line 16, in <module>
[stderr] from botocore.endpoint import DEFAULT_TIMEOUT, MAX_POOL_CONNECTIONS
[stderr] File "/usr/lib/python3/dist-packages/botocore/endpoint.py", line 22, in <module>
[stderr] from botocore.awsrequest import create_request_object
[stderr] File "/usr/lib/python3/dist-packages/botocore/awsrequest.py", line 24, in <module>
[stderr] import botocore.utils
[stderr] File "/usr/lib/python3/dist-packages/botocore/utils.py", line 32, in <module>
[stderr] import botocore.httpsession
[stderr] File "/usr/lib/python3/dist-packages/botocore/httpsession.py", line 10, in <module>
[stderr] from urllib3.util.ssl_ import (
[stderr]ImportError: cannot import name 'PROTOCOL_TLS' from 'urllib3.util.ssl_' (/home/ubuntu/.local/lib/python3.10/site-packages/urllib3/util/ssl_.py)

I noticed this issue might be related to my recent installation of zaproxy (OWASP ZAP), which may have introduced some Python packages incompatible with the system environment, such as urllib3. My local Python packages are installed in /home/ubuntu/.local/lib/python3.10/, and this seems to be conflicting with the system's global package versions.

Could the installation of zaproxy be causing the CodeDeploy deployment failures? How can I resolve the Python package version conflict to ensure both zaproxy and AWS CLI work correctly? Is there a way to isolate the zaproxy environment to prevent it from affecting other system tools?

DD-Boom
feita há 2 meses64 visualizações
1 Resposta
0

Hello,

Reviewing the above error message it seems the script itself is failing which is causing the deployment to fail. To further troubleshoot the issue I would recommend to login (SSH) to the EC2 instance and test the working of your affected script by executing it manually.

Additionally, as you mentioned that shell/after.sh run as user ubuntu failed with exit code 1, Thus I would request you to please try and execute shell/after.sh script using root user and check if that works for you.

Moreover I would request you to review the script logs from the location below -

less /opt/codedeploy-agent/deployment-root/<deployment-group-ID>/<deployment-ID>/logs/scripts.log

https://docs.aws.amazon.com/codedeploy/latest/userguide/deployments-view-logs.html#deployments-view-logs-instance

In case you are still facing any issues, I would recommend to create a support case with AWS Premium support for further troubleshooting so that support team can have a deeper look at your environment configuration. This would help us to reproduce the issue, if required further.

AWS
ENGENHEIRO DE SUPORTE
respondido há 2 meses
  • The installation of zaproxy caused a conflict with the Python package. I have deleted all the extra zaproxy related packages. Codedeploy has returned to normal. I still need to find a way to isolate zaproxy.

Você não está conectado. Fazer login para postar uma resposta.

Uma boa resposta responde claramente à pergunta, dá feedback construtivo e incentiva o crescimento profissional de quem perguntou.

Diretrizes para responder a perguntas