amqp / rhea-promise

A promisified layer over rhea AMQP client
Apache License 2.0
30 stars 19 forks source link

Unable to open the amqp connection ... due to operation timeout <- defaultOperationTimeoutInSeconds is undefined #98

Closed bogdanbrudiu closed 1 year ago

bogdanbrudiu commented 1 year ago

Describe the bug A clear and concise description of what the bug is.

when I try to connect

 this.container.connect({
            connection_details: this.ws(this.metadata.url, ['amqp']),
            reconnect: true,
            max_reconnect_delay: 10000,
            reconnect_limit: 10,
            transport: 'tls',
        })

I get Unable to open the amqp connection "${this.id}" due to operation timeout. no matter if I specify or not operationTimeoutInSeconds in the options

I think the issue is here: https://github.com/amqp/rhea-promise/blob/7f4f3e54b50cf45e8a59156680cd6905b070ecf1/lib/connection.ts#L256 this.options.operationTimeoutInSeconds = options.operationTimeoutInSeconds; <-this is undefined

To Reproduce Steps to reproduce the behavior:

Expected behavior A clear and concise description of what you expected to happen. provided operationTimeoutInSeconds should be used or if not the default value (60)

Package-version: 3.0.0 node.js version: 16.18.1 OS name and version: Windows 10 Pro Version 10.0.19045 Build 19045

Additional context Add any other context about the problem here.

woppa684 commented 1 year ago

It seems to be caused by this commit https://github.com/amqp/rhea-promise/commit/64a92def48c75b44bbd35ccb12efe39e06d43ea5#diff-9aad8fb1e4d88d17816efb409679b04b0978f2d8423c0b218bc96a53b763b92cL234-L236 Where the lines that set the default timeout have been moved inside the else statement.

Since the connect call on the container doesn't provide the operationTimeoutInSeconds in the options it will now be undefined. Workaround is to not use the connect method on the container but create a Connection directly.

jeremymeng commented 1 year ago

@bogdanbrudiu @woppa684 thanks for reporting and investigating the issue. v3.0.1 has been published with a fix. Please let us know if it addresses the problem.