Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pins with integer attributes not supported? #60

Closed
paolochiodi opened this issue Oct 13, 2016 · 2 comments · Fixed by #62
Closed

Pins with integer attributes not supported? #60

paolochiodi opened this issue Oct 13, 2016 · 2 comments · Fixed by #62
Assignees

Comments

@paolochiodi
Copy link

If I define a seneca instance to listen to a message that contains an integer attribute I get a fatal error. The same message, with a string value instead will work.
This is unfortunate because messages like remote:1 will get translated to {remote:1} and not {remote:'1'}

Examples:

Won't work:

const Seneca = require('seneca')
const seneca = Seneca()
seneca.use('amqp-transport')
seneca.listen({
  type: 'amqp',
  url: 'amqp://guest:guest@localhost:5672',
  pin: 'remote:1'
})
const Seneca = require('seneca')
const seneca = Seneca()
seneca.use('amqp-transport')
seneca.listen({
  type: 'amqp',
  url: 'amqp://guest:guest@localhost:5672',
  pin: {remote:1}
})

Will work

const Seneca = require('seneca')
const seneca = Seneca()
seneca.use('amqp-transport')
seneca.listen({
  type: 'amqp',
  url: 'amqp://guest:guest@localhost:5672',
  pin: {remote:'1'}
})
const Seneca = require('seneca')
const seneca = Seneca()
seneca.use('amqp-transport')
seneca.client({
  type: 'amqp',
  url: 'amqp://guest:guest@localhost:5672',
  pin: 'remote:1'
})

Error received

Seneca Fatal Error
==================

Message: seneca: value.replace is not a function

Code: transport_listen

Details: { type: 'amqp',
  url: 'amqp://guest:guest@localhost:5672',
  pin: 'remote:1',
  'orig$':
   { TypeError: value.replace is not a function
       at _.forOwn (/Users/paolochiodi/Projects/seneca/seneca-zipkin-tracer/node_modules/seneca-amqp-transport/lib/amqp-util.js:152:21)
       at /Users/paolochiodi/Projects/seneca/seneca-zipkin-tracer/node_modules/seneca-amqp-transport/node_modules/lodash/lodash.js:4917:15
       at baseForOwn (/Users/paolochiodi/Projects/seneca/seneca-zipkin-tracer/node_modules/seneca-amqp-transport/node_modules/lodash/lodash.js:2979:24)
       at Function.forOwn (/Users/paolochiodi/Projects/seneca/seneca-zipkin-tracer/node_modules/seneca-amqp-transport/node_modules/lodash/lodash.js:12926:24)
       at stringify (/Users/paolochiodi/Projects/seneca/seneca-zipkin-tracer/node_modules/seneca-amqp-transport/lib/amqp-util.js:147:5)
@nfantone
Copy link
Collaborator

@paolochiodi Never run into this before. Then again, I've never tried setting a pin to a Number. Looks like a bug.

Incidentally, is this even supported by Seneca, in general? Do other transports behave differently?

@paolochiodi
Copy link
Author

@rjrodger or @mcdonnelldean may better know what is the intended behaviour, but from my experience it works with seneca. I've also tried both http and tcp transports and they work as expected

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants