abreits / amqp-ts

AmqpSimple, a RabbitMQ tested Amqp library written in and for Typescript
MIT License
133 stars 37 forks source link

Unhandled rejection TypeError: message.sendTo is not a function #47

Closed icpenguins closed 5 years ago

icpenguins commented 5 years ago

I get the below exception when trying to use Exchange.send(...) rather than Exchange.publish(...) even though it is supposed to be deprecated.

Unhandled rejection TypeError: message.sendTo is not a function at Exchange.send (...\node_modules\amqp-ts\lib\amqp-ts.js:498:17) at ...\src\service\amqp\AmqpManager.js:48:33 at tryCatcher (...\node_modules\bluebird\js\release\util.js:16:23) at Promise._settlePromiseFromHandler (...\node_modules\bluebird\js\release\promise.js:547:31) at Promise._settlePromise (...\node_modules\bluebird\js\release\promise.js:604:18) at Promise._settlePromise0 (...\node_modules\bluebird\js\release\promise.js:649:10) at Promise._settlePromises (...\node_modules\bluebird\js\release\promise.js:729:18) at Promise._fulfill (...\node_modules\bluebird\js\release\promise.js:673:18) at PromiseArray._resolve (...\node_modules\bluebird\js\release\promise_array.js:127:19) at PromiseArray._promiseFulfilled (...\node_modules\bluebird\js\release\promise_array.js:145:14) at Promise._settlePromise (...\node_modules\bluebird\js\release\promise.js:609:26) at Promise._settlePromise0 (...\node_modules\bluebird\js\release\promise.js:649:10) at Promise._settlePromises (...\node_modules\bluebird\js\release\promise.js:729:18) at _drainQueueStep (...\node_modules\bluebird\js\release\async.js:93:12) at _drainQueue (...\node_modules\bluebird\js\release\async.js:86:9) at Async._drainQueues (...\node_modules\bluebird\js\release\async.js:102:5)

austin-beer commented 5 years ago

Exchange.send() requires you to pass an Message object as the first parameter. Exchange.publish() required you to pass the contents of the Message as the first parameter. Are you wrapping your data in a Message object before calling Exchange.send()?

icpenguins commented 5 years ago

That appears to work. I appreciate the quick feedback!