Ok, I was able to make this work using PhantomJS instead of node. For some reason using xmlhttprequest on node would not work for me.
In PhantomJS in order to enable xmlhttprequest to work with a remote service, you need to invoke with command line options as follows:
phantomjs --local-to-remote-url-access=true --web-security=false yoursampleterrainscript.js
If anyone is able to make this work under node, I would really appreciate a reply. Not a show stopper for me at the moment, but it would be nice to be able to do this from within node.
Thank you,
Ricardo