skip to Main Content

I am using Python 3.9 and I am trying to build the code in Git Actions.
I am seeing this new error today.Till 30th Dec, I didnt face any issue while building the same code. I am not explicitly using any PyOpenSSL package/ Cryptography package.So its not code issue.

However, I tried downgrading and upgrading PyopenSSL and Cryptography package, yet I am facing same issue.

Run sam build --config-env dev
Traceback (most recent call last):
  File "/home/runner/work/_temp/setup-sam-A5vDEq/bin/sam", line 8, in <module>
    sys.exit(cli())
  File "/home/runner/work/_temp/setup-sam-A5vDEq/.venv/lib/python3.9/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/home/runner/work/_temp/setup-sam-A5vDEq/.venv/lib/python3.9/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/home/runner/work/_temp/setup-sam-A5vDEq/.venv/lib/python3.9/site-packages/click/core.py", line 1651, in invoke
    cmd_name, cmd, args = self.resolve_command(ctx, args)
  File "/home/runner/work/_temp/setup-sam-A5vDEq/.venv/lib/python3.9/site-packages/click/core.py", line 1698, in resolve_command
    cmd = self.get_command(ctx, cmd_name)
  File "/home/runner/work/_temp/setup-sam-A5vDEq/.venv/lib/python3.9/site-packages/samcli/cli/command.py", line 133, in get_command
    mod = importlib.import_module(pkg_name)
  File "/opt/hostedtoolcache/Python/3.9.16/x64/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/home/runner/work/_temp/setup-sam-A5vDEq/.venv/lib/python3.9/site-packages/samcli/commands/build/__init__.py", line 6, in <module>
    from .command import cli  # noqa
  File "/home/runner/work/_temp/setup-sam-A5vDEq/.venv/lib/python3.9/site-packages/samcli/commands/build/command.py", line 12, in <module>
    from samcli.commands._utils.options import (
  File "/home/runner/work/_temp/setup-sam-A5vDEq/.venv/lib/python3.9/site-packages/samcli/commands/_utils/options.py", line 21, in <module>
    from samcli.commands._utils.template import get_template_data, TemplateNotFoundException
  File "/home/runner/work/_temp/setup-sam-A5vDEq/.venv/lib/python3.9/site-packages/samcli/commands/_utils/template.py", line 10, in <module>
    from botocore.utils import set_value_from_jmespath
  File "/home/runner/work/_temp/setup-sam-A5vDEq/.venv/lib/python3.9/site-packages/botocore/utils.py", line 37, in <module>
    import botocore.httpsession
  File "/home/runner/work/_temp/setup-sam-A5vDEq/.venv/lib/python3.9/site-packages/botocore/httpsession.py", line 46, in <module>
    from urllib3.contrib.pyopenssl import (
  File "/home/runner/work/_temp/setup-sam-A5vDEq/.venv/lib/python3.9/site-packages/urllib3/contrib/pyopenssl.py", line 50, in <module>
    import OpenSSL.crypto
  File "/home/runner/work/_temp/setup-sam-A5vDEq/.venv/lib/python3.9/site-packages/OpenSSL/__init__.py", line 8, in <module>
    from OpenSSL import crypto, SSL
  File "/home/runner/work/_temp/setup-sam-A5vDEq/.venv/lib/python3.9/site-packages/OpenSSL/crypto.py", line 3268, in <module>
    _lib.OpenSSL_add_all_algorithms()
AttributeError: module 'lib' has no attribute 'OpenSSL_add_all_algorithms'
Error: Process completed with exit code 1.

Can anyone please help me how to resolve this? Looks like some upgrade has happened couple of hours back in ‘cryptography’ module.I am not sure if that is causing the issue.

I am seeing this new error today.Till 30th Dec, I didnt face any issue while building the same code. I am not explicitly using any PyOpenSSL package/ Cryptography package.So its not code issue.

However, I tried downgrading and upgrading PyopenSSL and Cryptography package, yet I am facing same issue.

When the git actions installs python I can see it downloads pyopenssl.
Collecting pyopenssl==22.0.0 Downloading pyOpenSSL-22.0.0-py2.py3-none-any.whl (55 kB)

Here is the list of commands/actions I have in my git actions file:

jobs: deploy: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: actions/setup-python@v4 with: python-version: '3.9' - uses: aws-actions/setup-sam@v2 - uses: aws-actions/configure-aws-credentials@v1 with: aws-access-key-id: aws-secret-access-key: aws-region: us-east-2 - run: echo "export SAM_CLI_TELEMETRY=0" >>~/.profile - run: source ~/.profile # Run unit tests - run: pip install -r tests/requirements.txt - run: python -m pytest tests/unit -v

2

Answers


  1. Try this:

    pip install --upgrade pyopenssl
    

    Make sure to add it after any pip install --upgrade awscli asw-sam-cli calls.

    Login or Signup to reply.
  2. Downgrade the sam version to 1.59.0 to fix the issue.

    jobs:
      deploy:
        runs-on: ubuntu-latest
        steps:    
          - uses: aws-actions/setup-sam@v2
            with:
              version: 1.59.0
    

    You can refer the similar issue addressed in sam build from Github actions suddenly failing from today

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search