Error when communicating to azure queues from node.js in a WebRole #434

Closed
jimzim opened this Issue Oct 31, 2012 · 9 comments

Comments

Projects
None yet
2 participants

jimzim commented Oct 31, 2012

I am getting this error when trying to create a message on a queue in azure using node.js azure package version 0.6.6: {"code":"ECONNREFUSED","errno":"ECONNREFUSED","syscall":"connect"}

It only happens in the deployed WebRole, but works fine locally on my windows box and in Azure websites. I need this to be in a webrole as I need to have an SSL certificate.

I posted this on stackoverflow, but thought i would submit it here as well since this seems more appropriate of a place to let the developers know about the issue.

This question is here: http://stackoverflow.com/questions/13160366/error-when-communicating-to-azure-queues-from-node-js-in-a-webrole

Thanks,
Jim

Member

markcowl commented Nov 2, 2012

@jimzim This sounds like an issue with the credentials you are using to connect, are you using dev store credentials locally and account credentials in the cloud? How are you constructing the queue service?

jimzim commented Nov 2, 2012

No the credentials are good. It works locally when talking to live queues in azure and also works fine in azure websites. It does not work when deploying to a webrole as described above.

I am deploying the web role as described in this article.
https://www.windowsazure.com/en-us/develop/nodejs/tutorials/getting-started/

Thanks,
Jim

Member

markcowl commented Nov 2, 2012

@jimzim are the credentials provided in the queueservice factory, or are they in web.config? In web role, web.config is used locally and web.cloud.config is used in the cloud

jimzim commented Nov 2, 2012

I put the credentials in code and am not relying on the web.config anywhere. The same code is running in azure websites and local on windows and Mac, just not in the web role.

Member

markcowl commented Nov 2, 2012

@jimzim hmm, can you share the call to the factory (redact the credentials, please :-).

Member

markcowl commented Nov 2, 2012

@jimzim, also please check that your web.cloud.config does not have EMULATED=true in the AppSettings section

jimzim commented Nov 2, 2012

Here you go. Also if i remove the createIfNotExists it still does not work.

I also made sure that is not in web.cloud.config. It is in the regular web.config i noticed though locally. I can also RDP into the box and see what the web.config says on the server.

var azure = require('azure');
var account = "";
var access_key = "";
var queueService = azure.createQueueService(account, access_key);
var queueName = "";

    queueService.createQueueIfNotExists(queueName, function (error) {
        if (!error) {
            // Queue exists

            console.log(queueName + " exists");

            var msg = req.body;
            queueService.createMessage(queueName, JSON.stringify(msg, null), function (error) {
                if (!error) {
                    console.log("message inserted");
                }
                else {
                    res.json(error, 503);
                }
            });
        }
        else {
            res.json(error, 503); // 503 error
        }
    });
Member

markcowl commented Nov 2, 2012

@jimzim please try removing the EMULATED env var from web.config before you publish. There was a bug (fixed in the 0.6.7 release) that prevented replacing web.cloud.config for web.config.

jimzim commented Nov 6, 2012

Yep that worked. Thanks! I will also update the azure from npm, i see you just release 0.6.7 a few days ago.

markcowl closed this Nov 13, 2012

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