azure-contrib / socket.io-servicebus

socket.io store which uses Service Bus pub/sub for scale out
Apache License 2.0
30 stars 14 forks source link

Cannot read property 'topic' of undefined #18

Closed richorama closed 11 years ago

richorama commented 11 years ago

I followed the sample code, and get an error when a client attempts to establish a connection.

   info  - socket.io started
   debug - served static content /socket.io.js
   debug - client authorized
   info  - handshake authorized kYp4ovKD_5oAxMSt42fT

C:\Users\richard.astbury\Desktop\bus\node_modules\socket.io-servicebus\lib\servicebusinterface.js:71
w Error('Failed to write to service bus on topic %s, err = %s', this.topic, ut
                                                                    ^
TypeError: Cannot read property 'topic' of undefined
    at ServiceBusInterface.send (C:\Users\richard.astbury\Desktop\bus\node_modules\socket.io-servicebus\lib\servicebusinterface.js:71:98)
    at ServiceBusService._sendMessage.finalCallback (C:\Users\richard.astbury\Desktop\bus\node_modules\azure\lib\services\serviceBus\servicebusservice.js:306:7)
    at ServiceClient._initDefaultFilter.filter (C:\Users\richard.astbury\Desktop\bus\node_modules\azure\lib\services\core\serviceclient.js:601:11)
    at ServiceBusService._sendMessage.processResponseCallback (C:\Users\richard.astbury\Desktop\bus\node_modules\azure\lib\services\serviceBus\servicebusservice.js:309:5)
    at Request.ServiceClient._performRequest.self._buildRequestOptions.processResponseCallback [as _callback] (C:\Users\richard.astbury\Desktop\bus\node_modules\azure\lib\services\core\serviceclient.js:228:11)
    at Request.init.self.callback (C:\Users\richard.astbury\Desktop\bus\node_modules\azure\node_modules\request\main.js:122:22)
    at Request.EventEmitter.emit (events.js:99:17)
    at Request.<anonymous> (C:\Users\richard.astbury\Desktop\bus\node_modules\azure\node_modules\request\main.js:661:16)
    at Request.EventEmitter.emit (events.js:126:20)
    at IncomingMessage.Request.start.self.req.self.httpModule.request.buffer (C:\Users\richard.astbury\Desktop\bus\node_modules\azure\node_modules\request\main.js:623:14)
christav commented 11 years ago

@richorama Thanks for trying this out! I suspect this was the result of not setting the environment up properly. This project is still very early, so we've got the happy path working but haven't spent much time on error handling or documentation on how to set up & run the sample.

Could you verify that you've done the following:

  1. Created a service bus namespace
  2. Created a topic in that namespace
  3. Created a separate subscription in that topic for each node server
  4. Grabbed the connection string for your namespace and stored it in the SB_CONN environment variable
  5. run the sample server as: node app.js <topic name> <subscription name> <port>

If you've done that and it's still failing, something weird's going on and we can continue diagnosing.

glennblock commented 11 years ago

Yes, and granted we need better error handling!

On Fri, Feb 15, 2013 at 3:01 PM, Chris Tavares notifications@github.comwrote:

@richorama https://github.com/richorama Thanks for trying this out! I suspect this was the result of not setting the environment up properly. This project is still very early, so we've got the happy path working but haven't spent much time on error handling or documentation on how to set up & run the sample.

Could you verify that you've done the following:

  1. Created a service bus namespace
  2. Created a topic in that namespace
  3. Created a separate subscription in that topic for each node server
  4. Grabbed the connection string for your namespace and stored it in the SB_CONN environment varible
  5. run the sample server as: node app.js

If you've done that and it's still failing, something weird's going on and we can continue diagnosing.

— Reply to this email directly or view it on GitHubhttps://github.com/WindowsAzure/socket.io-servicebus/issues/18#issuecomment-13632835.

richorama commented 11 years ago

Sorry, my mistake, I hadn't created a topic or subscription.

As a side note, I would expect the store to create and manage the subscriptions for me.

glennblock commented 11 years ago

@richorama

We had discussed this, but initially punted on it to keep focused and to keep the apj simpler. Topics and subscriptions are persistent entities and have their own properties.

there are new transient subscriptions coming which we can create and which will die automatically and which we are going to add support for . We can also visit creating the topic.

can you file a bug?

Thanks Glenn

On Mon, Feb 25, 2013 at 4:50 AM, Richard Astbury notifications@github.comwrote:

Sorry, my mistake, I hadn't created a topic or subscription.

As a side note, I would expect the store to create and manage the subscriptions for me.

— Reply to this email directly or view it on GitHubhttps://github.com/WindowsAzure/socket.io-servicebus/issues/18#issuecomment-14039465.

christav commented 11 years ago

I already filed #24 for the autocreation of subscriptions.

glennblock commented 11 years ago

How about topics?

On Mon, Feb 25, 2013 at 7:19 AM, Chris Tavares notifications@github.comwrote:

I already filed #24https://github.com/WindowsAzure/socket.io-servicebus/issues/24for the autocreation of subscriptions.

— Reply to this email directly or view it on GitHubhttps://github.com/WindowsAzure/socket.io-servicebus/issues/18#issuecomment-14047874.

richorama commented 11 years ago

Topics would be useful too, but I would anticipate you would only create one topic. You would need a subscription every time you started a new node process.

glennblock commented 11 years ago

@richorama I meant that for Chris to see if we had a bug filed :-)

As to subscriptions, the new transient subscriptions are really what we need as otherwise you end up with an explosion of subscriptions that hang around. With the new expiry model we can set them to die after being idle.

On Mon, Feb 25, 2013 at 8:57 AM, Richard Astbury notifications@github.comwrote:

Topics would be useful too, but I would anticipate you would only create one topic. You would need a subscription every time you started a new node process.

— Reply to this email directly or view it on GitHubhttps://github.com/WindowsAzure/socket.io-servicebus/issues/18#issuecomment-14054159.