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

Already on GitHub? Sign in to your account

ServiceBus createTopicIfNotExists fails with TypeError: Cannot set property 'body' of null #498

Closed
tmrudick opened this Issue Nov 27, 2012 · 4 comments

Comments

Projects
None yet
4 participants

Test estimate: 1

I was trying to run createTopicIfNotExists and incorrectly typed in my endpoint and key combination so that my service bus object was invalid.

When I attempt to run createTopicIfNotExists, an unhandled error is thrown from within the service bus code:

C:\src\scratch\azuresdk\node_modules\azure\lib\services\core\serviceclient.js:210
        finalRequestOptions.body = body.outputData;
                                 ^
TypeError: Cannot set property 'body' of null
    at C:\src\scratch\azuresdk\node_modules\azure\lib\services\core\serviceclient.js:210:34
    at C:\src\scratch\azuresdk\node_modules\azure\lib\services\core\serviceclient.js:264:7
    at ServiceBusService.filter (C:\src\scratch\azuresdk\node_modules\azure\lib\services\core\serviceclient.js:534:7)
    at C:\src\scratch\azuresdk\node_modules\azure\lib\services\core\serviceclient.js:261:10
    at C:\src\scratch\azuresdk\node_modules\azure\lib\services\core\servicebusserviceclient.js:104:5
    at C:\src\scratch\azuresdk\node_modules\azure\lib\services\serviceBus\wrap.js:69:5
    at C:\src\scratch\azuresdk\node_modules\azure\lib\services\serviceBus\wraptokenmanager.js:76:5
    at C:\src\scratch\azuresdk\node_modules\azure\lib\services\serviceBus\wrapservice.js:98:7
    at C:\src\scratch\azuresdk\node_modules\azure\lib\services\core\serviceclient.js:538:11
    at C:\src\scratch\azuresdk\node_modules\azure\lib\services\serviceBus\wrapservice.js:101:5

Repro code:

var azure = require('azure');

// Succeeds.
var serviceBusService = azure.createServiceBusService('servicebus-test', 'ThisIsMykey');

// fails, but the error argument is not ever read by either code path.
serviceBusService.createTopicIfNotExists('MobileServicesTopic', function(error){
    if(!error){
        // Topic was created or exists
        console.log("The topic was created or already exists");
    }
    else {
        console.log("There was an error creating the topic", error);
  }
});

I would expect an error to be passed into my callback function letting me know that my configuration is incorrect instead of throwing this error which is only catchable with a global error handler.

@ghost ghost assigned markcowl Dec 3, 2012

Member

markcowl commented Dec 3, 2012

@tmrudick what node and sdk versions are you using?

tmrudick commented Dec 5, 2012

This is on node v0.6.20 and v0.6.8 of the azure node sdk.

andrerod pushed a commit to andrerod/azure-sdk-for-node that referenced this issue Dec 10, 2012

@ghost ghost assigned andrerod Dec 10, 2012

This is related to error handling. im taking this one.

andrerod pushed a commit to andrerod/azure-sdk-for-node that referenced this issue Dec 22, 2012

Merge pull request #17 from andrerod/errors
#498: Fixing incorrect error message processing

@ghost ghost assigned markcowl Dec 22, 2012

@ghost ghost assigned maying Feb 5, 2013

Member

markcowl commented Feb 5, 2013

verified in unit test

@markcowl markcowl closed this Feb 5, 2013

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