Skip to content

bug: event-ruler failing to install in Docker with EventBridgeV2 #11299

@sujee81

Description

@sujee81

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

I'm trying to test multi-accounts EventBridge integration using LocalStack. I have enabled EventBridgeV2 and when I send a message to source EventBus from the localstack web app, I get an error Installation of event-ruler failed.. This happens regardless if I test multi-accounts event bus or just the local bus. EventBridgeV1 works fine for local bus but does not deliver across accounts. Appreciate your help on looking at this issue.

Docker compose (WSL Ubuntu on Windows)

services:
  localstack:
    container_name: "localstack-main"
    image: localstack/localstack
    ports:
      - "127.0.0.1:4566:4566"
      - "127.0.0.1:4510-4559:4510-4559"
    volumes:
      - "${LOCALSTACK_VOLUME_DIR:-./volume}:/var/lib/localstack"
      - "/var/run/docker.sock:/var/run/docker.sock"
    environment:
      - PROVIDER_OVERRIDE_EVENTS=v2

Debug message (Copied from web app error dialog, not formatted nicely)

exception while calling events.PutEvents: Traceback (most recent call last): File "/opt/code/localstack/.venv/lib/python3.11/site-packages/urllib3/connectionpool.py", line 466, in _make_request self._validate_conn(conn) File "/opt/code/localstack/.venv/lib/python3.11/site-packages/urllib3/connectionpool.py", line 1095, in _validate_conn conn.connect() File "/opt/code/localstack/.venv/lib/python3.11/site-packages/urllib3/connection.py", line 652, in connect sock_and_verified = _ssl_wrap_socket_and_match_hostname( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/code/localstack/.venv/lib/python3.11/site-packages/urllib3/connection.py", line 805, in _ssl_wrap_socket_and_match_hostname ssl_sock = ssl_wrap_socket( ^^^^^^^^^^^^^^^^ File "/opt/code/localstack/.venv/lib/python3.11/site-packages/urllib3/util/ssl_.py", line 465, in ssl_wrap_socket ssl_sock = _ssl_wrap_socket_impl(sock, context, tls_in_tls, server_hostname) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/code/localstack/.venv/lib/python3.11/site-packages/urllib3/util/ssl_.py", line 509, in _ssl_wrap_socket_impl return ssl_context.wrap_socket(sock, server_hostname=server_hostname) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/ssl.py", line 517, in wrap_socket return self.sslsocket_class._create( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/ssl.py", line 1104, in _create self.do_handshake() File "/usr/local/lib/python3.11/ssl.py", line 1382, in do_handshake self._sslobj.do_handshake() ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate in certificate chain (_ssl.c:1006) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/opt/code/localstack/.venv/lib/python3.11/site-packages/urllib3/connectionpool.py", line 789, in urlopen response = self._make_request( ^^^^^^^^^^^^^^^^^^^ File "/opt/code/localstack/.venv/lib/python3.11/site-packages/urllib3/connectionpool.py", line 490, in _make_request raise new_e urllib3.exceptions.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate in certificate chain (_ssl.c:1006) The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/opt/code/localstack/.venv/lib/python3.11/site-packages/requests/adapters.py", line 667, in send resp = conn.urlopen( ^^^^^^^^^^^^^ File "/opt/code/localstack/.venv/lib/python3.11/site-packages/urllib3/connectionpool.py", line 843, in urlopen retries = retries.increment( ^^^^^^^^^^^^^^^^^^ File "/opt/code/localstack/.venv/lib/python3.11/site-packages/urllib3/util/retry.py", line 519, in increment raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ urllib3.exceptions.MaxRetryError: MyHTTPSConnectionPool(host='repo1.maven.org', port=443): Max retries exceeded with url: /maven2/com/fasterxml/jackson/core/jackson-annotations/2.16.2/jackson-annotations-2.16.2.jar (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate in certificate chain (_ssl.c:1006)'))) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/opt/code/localstack/localstack-core/localstack/packages/api.py", line 91, in install self._install(target) File "/opt/code/localstack/localstack-core/localstack/packages/core.py", line 356, in _install dependency._install(target) File "/opt/code/localstack/localstack-core/localstack/packages/core.py", line 61, in _install download(download_url, target_path) File "/opt/code/localstack/localstack-core/localstack/utils/http.py", line 199, in download r = s.get(url, stream=True, verify=_verify, timeout=timeout, headers=request_headers) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/code/localstack/.venv/lib/python3.11/site-packages/requests/sessions.py", line 602, in get return self.request("GET", url, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/code/localstack/.venv/lib/python3.11/site-packages/requests/sessions.py", line 589, in request resp = self.send(prep, **send_kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/code/localstack/.venv/lib/python3.11/site-packages/requests/sessions.py", line 703, in send r = adapter.send(request, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/code/localstack/.venv/lib/python3.11/site-packages/requests/adapters.py", line 698, in send raise SSLError(e, request=request) requests.exceptions.SSLError: MyHTTPSConnectionPool(host='repo1.maven.org', port=443): Max retries exceeded with url: /maven2/com/fasterxml/jackson/core/jackson-annotations/2.16.2/jackson-annotations-2.16.2.jar (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate in certificate chain (_ssl.c:1006)'))) The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/opt/code/localstack/.venv/lib/python3.11/site-packages/rolo/gateway/chain.py", line 166, in handle handler(self, self.context, response) File "/opt/code/localstack/localstack-core/localstack/aws/handlers/service.py", line 113, in __call__ handler(chain, context, response) File "/opt/code/localstack/localstack-core/localstack/aws/handlers/service.py", line 83, in __call__ skeleton_response = self.skeleton.invoke(context) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/code/localstack/localstack-core/localstack/aws/skeleton.py", line 154, in invoke return self.dispatch_request(serializer, context, instance) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/code/localstack/localstack-core/localstack/aws/skeleton.py", line 168, in dispatch_request result = handler(context, instance) or {} ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/code/localstack/localstack-core/localstack/aws/skeleton.py", line 118, in __call__ return self.fn(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/code/localstack/localstack-core/localstack/aws/api/core.py", line 157, in operation_marker return fn(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^ File "/opt/code/localstack/localstack-core/localstack/services/events/provider.py", line 686, in put_events entries, failed_entry_count = self._process_entries(context, entries) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/code/localstack/localstack-core/localstack/services/events/provider.py", line 1286, in _process_entries if matches_rule(event_str, event_pattern): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/code/localstack/localstack-core/localstack/services/events/event_ruler.py", line 46, in matches_rule start_jvm() File "/opt/code/localstack/localstack-core/localstack/utils/objects.py", line 203, in _singleton_factory instance.set(factory()) ^^^^^^^^^ File "/opt/code/localstack/localstack-core/localstack/services/events/event_ruler.py", line 28, in start_jvm event_ruler_libs_path = get_event_ruler_libs_path() ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/code/localstack/localstack-core/localstack/services/events/event_ruler.py", line 36, in get_event_ruler_libs_path installer.install() File "/opt/code/localstack/localstack-core/localstack/packages/api.py", line 102, in install raise PackageException(f"Installation of {self.name} failed.") from e localstack.packages.api.PackageException: Installation of event-ruler failed

Expected Behavior

EventBus should deliver message to appropriate destinations defined by the rule e.g. Another event bus in a separate account

How are you starting LocalStack?

With a docker-compose file

Steps To Reproduce

  1. Run Docker compose and create an EventBridge and a target
const eb= new events.EventBus(this, 'test-eb', {
      eventBusName: 'Test EB'
    });

 const fn = new lambda.Function(this, 'MyFunc', {
      runtime: lambda.Runtime.NODEJS_LATEST,
      handler: 'index.handler',
      code: lambda.Code.fromInline(`exports.handler = async (event) => {
          console.log('request:', JSON.stringify(event, undefined, 2));

          return {
            statusCode: 200,
            headers: {'Content-Type': 'application/json' },
            body: JSON.stringify({ message: 'Hello world' }),
          };
        }`)
    });

const rule = new events.Rule(this, 'rule', {
      eventBus: eb,
      eventPattern: {
        source: ["myapp"],
      },
    });

rule.addTarget(new targets.LambdaFunction(fn, {
      maxEventAge: Duration.hours(2),
      retryAttempts: 2,
    }));
  1. Now sends a event to eventbus using localapp web UI or CLI, with source as myapp

Environment

- OS:
- LocalStack:
  LocalStack version:
  LocalStack Docker image sha:
  LocalStack build date:
  LocalStack build git hash:

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions