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
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...
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
Related
I have an issue with a custom sender/receiver application was written a while back.
We recently merged to the cloud and the sender application which is a simple web page was moved and changed its URL from what it used to be.
http: //sdpc.webpage.com to what it is now https: //webpage.com/sdpc.
Now it appears my messages are not being sent over to the receiver application.
I have the following code to send the message to the receiver:
var applicationID = 'F7000000';
var namespace = 'urn:x-cast:com.webpage.cast.sdpc';
var session= null;
var driverRequest;
function sendMessage(message) {
if (session != null) {
location.reload();
session.sendMessage(namespace, message, onSuccess.bind(this,
"Message sent: " + message), onError.bind(this, "Error: " + message));
// $('messageDiv').set('html', session.sendMessage(namespace, message, onSuccess.bind(this, "Message sent: " + message), onError));
} else {
chrome.cast.requestSession(function(e) {
session = e;
location.reload();
session.sendMessage(namespace, message, onSuccess.bind(this,
"Message sent: " + message), onError.bind(this, "Error: " + message));
// $('messageDiv').set('html', session.sendMessage(namespace, message, onSuccess.bind(this, "Message sent: " + message), onError));
}, onError);
}
}
this all worked before we moved the folder over to what is now it's new location on the cloud. I made sure to change the receiver URL in the developer google console to point to its new location, but no luck. Could the namespace be the issue? It's the only thing I'm not sure about.
I believe the sender to receiver connection isn't even being established because I have code setup for any errors while displaying the image to the chrome cast and I am not seeing anything.
I've looked on the google forums and GitHub but I can't think of anything else that might be causing this issue.
not really sure why this got flagged down without letting me know why.
However I managed to solve my own question in case anyone ever needs it. As it turns out my web page was internal so by changing the url on the developer's google web page the receiver was not able to be reached from the outside world. However as soon as I transferred the project + url to a public facing web page and it worked. It took a couple of hours before it registered but it worked.
I am trying to create extension for bypassing server authentication, install it on Firefox browser and pass the .xpi file while driver creation so that it gets invoked while login and the server authentication is bypassed.
Facing error while installing the .xpi file on firefox.
Error: "This add on could not be installed because it appears to be corrupt"
Steps
1. Created a manifest.json file (Code mentioned below)
{
“name”: “Webrequest API”,
“version”: “1.0”,
“description”: “Extension to handle Authentication window”,
“permissions”: [
“webRequest”,
“webRequestBlocking”,
“”
],
“background”: {
“scripts”: [“webrequest.js”]
},
“manifest_version”: 2
}
Created webrequest.js file. Code mentioned below.
var target = “https://sso.viacomcloud.com/”;
var myCredentials = {
username: “getestone”,
password: “V*******”
}
var pendingRequests = [];
// A request has completed.
// We can stop worrying about it.
function completed(requestDetails) {
console.log(“completed: ” + requestDetails.requestId);
var index = pendingRequests.indexOf(requestDetails.requestId);
if (index > -1) {
pendingRequests.splice(index, 1);
}
}
function provideCredentialsSync(requestDetails) {
// If we have seen this request before, then
// assume our credentials were bad, and give up.
if (pendingRequests.indexOf(requestDetails.requestId) != -1) {
console.log(“bad credentials for: ” + requestDetails.requestId);
return {cancel:true};
}
pendingRequests.push(requestDetails.requestId);
console.log(“providing credentials for: ” + requestDetails.requestId);
return {authCredentials: myCredentials};
}
browser.webRequest.onAuthRequired.addListener(
provideCredentialsSync,
{urls: [target]},
[“blocking”]
);
browser.webRequest.onCompleted.addListener(
completed,
{urls: [target]}
);
Created a zip file using 7-zip file manager and renamed the zip file as Ext.xpi
Opened about:config on firefox (verson 70) and changed xpiextensionsignrequired to ‘False’
Opened about:addons on firefox. Selected ‘install extension from a file’. Select the Ext.xpi created in step 4 above.
I get the following error: ” this add on could not be installed because it appears to be corrupt.” instead of getting the Install option on Firefox browser.
Please help
#SubjectiveReality
Try using the class "Robot" and send keys in case you are looking for a quick solution.
Robot rb= new Robot();
rb.Keypress().....
I'm trying to use a node.js app to regularly decode some gtfs-realtime data. It's mostly running fine, but every few hours I run into an error that crashes my app. The error message in my log says that there is an "Illegal group end indicator for Message .transit_realtime.FeedMessage 7 (not a group)"
I found this question/answer on StackOverflow but it doesn't seem to solve my particular problem. Here is an outline of the code I am using to decode the gtfs-r feed:
//process the response
var processBuffers = function(response) {
var data = [];
response.on('data', function (chunk) {
data.push(chunk);
});
response.on('end', function () {
data = Buffer.concat(data);
var decodedFeedMessage = transit.FeedMessage.decode(data);
allData = decodedFeedMessage.entity;
//continues processing with allData...
});
}
Thanks!
NodeJs crashed issue basically happen every time, everydays that any kind of fatal error trigger. And since your received data from 3-rd party, It will very had to make sure the data always correct to prevent error as well.
The simple solution is using another system to deploy your NodeJS application. I recommend 2 tools that very popular today, PM2 and Passenger . (PM2 is very simple to use). Those tool will help to auto restart your NodeJS application once it crashed
http://pm2.keymetrics.io/
https://www.phusionpassenger.com/library/walkthroughs/deploy/nodejs/ownserver/nginx/oss/install_passenger_main.html
I've been experimenting with node-serialport library to access devices connected to a USB hub and send/receive data to these devices. The code works fine on linux but on windows(windows 8.1 and windows 7) I get some odd behaviour. It doesn't seem to work for more than 2 devices, it just hangs when writing to the port. The callback for write method never gets called. I'm not sure how to go about debugging this issue. I'm not a windows person, if someone can give me some directions it would be great.
Below is the code I'm currently using to test.
/*
Sample code to debug node-serialport library on windows
*/
//var SerialPort = require("./build/Debug/serialport");
var s = require("./serialport-logger");
var parsers = require('./parsers');
var ee = require('events');
s.list(function(err, ports) {
console.log("Number of ports available: " + ports.length);
ports.forEach(function(port) {
var cName = port.comName,
sp;
//console.log(cName);
sp = new s.SerialPort(cName, {
parser: s.parsers.readline("\r\n")
}, false);
// sp.once('data', function(data) {
// if (data) {
// console.log("Retrieved data " + data);
// //console.log(data);
// }
// });
//console.log("Is port open " + sp.isOpen());
if(!sp.isOpen()) {
sp.open(function(err) {
if(err) {
console.log("Port cannot be opened manually");
} else {
console.log("Port is open " + cName);
sp.write("LED=2\r\n", function(err) {
if (err) {
console.log("Cannot write to port");
console.error(err);
} else {
console.log("Written to port " + cName);
}
});
}
});
}
//sp.close();
});
});
I'm sure you'd have noticed I'm not require'ing serialport library instead I'm using serialport-logger library it's just a way to use the serialport addons which are compiled with debug switch on windows box.
TLDR; For me it works by increasing the threadpool size for libuv.
$ UV_THREADPOOL_SIZE=20 && node server.js
I was fine with opening/closing port for each command for a while but a feature request I'm working on now needs to keep the port open and reuse the connection to run the commands. So I had to find an answer for this issue.
The number of devices I could support by opening a connection and holding on to it is 3. The issue happens to be the default threadpool size of 4. I already have another background worker occupying 1 thread so I have only 3 threads left. The EIO_WatchPort function in node-serialport runs as a background worker which results in blocking a thread. So when I use more than 3 devices the "open" method call is waiting in the queue to be pushed to the background worker but since they are all busy it blocks node. Then any subsequent requests cannot be handled by node. Finally increasing the thread pool size did the trick, it's working fine now. It might help someone. Also this thread definitely helped me.
As opensourcegeek pointed all u need to do is to set UV_THREADPOOL_SIZE variable above default 4 threads.
I had problems at my project with node.js and modbus-rtu or modbus-serial library when I tried to query more tan 3 RS-485 devices on USB ports. 3 devices, no problem, 4th or more and permanent timeouts. Those devices responded in 600 ms interval each, but when pool was busy they never get response back.
So on Windows simply put in your node.js environment command line:
set UV_THREADPOOL_SIZE=8
or whatever u like till 128. I had 6 USB ports queried so I used 8.
I am creating a web app in node.js and golang. I need to connect nodejs with golang code which talks to mongodb and returns data to node program. is there any way to connect so? I tried to use gonode API.This is my code using gonode API.
my node.js file contains below code:
var Go = require('gonode').Go;
var options = {
path : 'gofile.go',
initAtOnce : true,
}
var go = new Go(options,function(err){
if(err) throw err;
go.execute({commandText: 'Hello world from gonode!'}, function(result, response) {
if(result.ok) {
console.log('Go responded: ' + response.responseText);
}
});
go.close();
}); `
And this is the code in my gofile.go file:
package main
import(
gonode "github.com/jgranstrom/gonodepkg"
json "github.com/jgranstrom/go-simplejson"
)
func main(){
gonode.Start(process)
}
func process(cmd *json.Json) (response *json.Json) {
response, m := json.MakeMap()
if(cmd.Get("commandText").MustString() == "Hello") {
m["responseText"] = "Well hello there!"
} else {
m["responseText"] = "What?"
}
return
}
This is the error am getting while running as node node.js in terminal
events.js:72
throw er; // Unhandled 'error' event
^
Error: write EPIPE
at errnoException (net.js:905:11)
at Object.afterWrite (net.js:721:19)
Golang from 1.5, you can build go to shared object binary file (*.so). This allows you to connect your go compiled library to be called by nodejs, python, ruby, java etc.
Here is a guide you could refer to: https://medium.com/learning-the-go-programming-language/calling-go-functions-from-other-languages-4c7d8bcc69bf
thanks for the response. I got a solution for this. I made 2 different servers. One for NodeJS and another for Golang. I am calling golang uri in Node server and getting data from golang server.
Based on a very cursive check of the gonode source code, the module seems to spawn go code as a child process and communicate through stdin/-out. EPIPE error means that the other end closed the stream. Based on this it might be that your go process exits prematurely.
You could try to debug the problem by modifying Command.prototype.execute in gonode/lib/command.js to print out the JSON that's sent to the go process. Then you can debug the go program by running it directly and giving it the same input via stdin.