问题
I have just gotten this error. Everything was working fine up until this morning.
Error: 400 - The request api-version is invalid because the the notification hub was created in an older version. Re-create the notification hub.
TrackingId:aaed084f-8c8a-49f1-8246-122763437b63_G7,TimeStamp:5/15/2016 3:56:13 AM"
In my node.js table script I am connecting to the hub like so:
var azure = require('azure');
var hub = azure.createNotificationHubService('hubName','connectionString');
And sending like so:
hub.wns.sendRaw(['public'], JSON.stringify(item), function(error){
if(!error)
console.log("total refresh " + JSON.stringify(item));
else
console.log("error sending total refresh " + JSON.stringify(error));
});
The error response keeps firing. I tried recreating the notification hub but still get the same error.
Does anybody know why? Have Microsoft updated their systems? Do I need to include an update for my javascript windows store application?
Thankyou
回答1:
The problem is that nodejs sdk doesn't set the api-version at all :) You can temporarily fix this by commenting these lines in the azure-sb module (or fix it in better way somehow):
azure-sb/lib/servicebusserviceclient.js @ line 67:
// Set API version
// if (webResource.queryString[Constants.ServiceBusConstants.API_VERSION_QUERY_KEY] === undefined) {
webResource.withQueryOption(Constants.ServiceBusConstants.API_VERSION_QUERY_KEY, Constants.ServiceBusConstants.CURRENT_API_VERSION);
// } else if (webResource.queryString[Constants.ServiceBusConstants.API_VERSION_QUERY_KEY] === null) {
// delete webResource.queryString[Constants.ServiceBusConstants.API_VERSION_QUERY_KEY];
// }
Anyway, waiting for Microsoft to fix this dumb error...
回答2:
Yah, thanks @Peter. I created temp module in root "azure-sb-temp", imported instead of "azure" in my notification service, installed packages "azure-common" and "underscore". The last thing is comment @ line 69, 71, 72, 73 at /azure-sb-temp/lib/servicebusserviceclient.js
来源:https://stackoverflow.com/questions/37234483/windows-azure-notification-hub-error