dynamicdan / sn-filesync

2-way sync ServiceNow field values to local files
MIT License
66 stars 37 forks source link

filesync on Windows OS #2

Closed jimser closed 9 years ago

jimser commented 9 years ago

Hi, I setup the filesync accordingly (instance, user/pass, directories). Now when I create an empty file and wait for the filesync mechansim to grab the content from the instance I get the following error:

C:tmp\filesync\app\src\snc-client.js:25
            if (res.statusCode !== 200) {
                   ^
TypeError: Cannot read property 'statusCode' of null
    at validateResponse (C:tmp\filesync\app\src\snc-client.js:25:20)
    at handleResponse (C:tmp\filesync\app\src\snc-client.js:69:23)
    at parseResponse (C:tmp\filesync\app\node_modules\restify\lib\clients\json_client.js:84:17)
    at ClientRequest.parseResponse (C:tmp\filesync\app\node_modules\restify\lib\clients\string_client.js:186:25)
    at ClientRequest.g (events.js:192:14)
    at ClientRequest.EventEmitter.emit (events.js:99:17)
    at C:tmp\filesync\app\node_modules\restify\lib\clients\http_client.js:150:37
    at process.startup.processNextTick.process._tickCallback (node.js:245:9)
dynamicdan commented 9 years ago

I also found this problem today but it is related to either the internet connection or the content coming back.

It is quite possible that the connection was refused by the server. Please try using a different internet connection. Otherwise, it could be that the record you downloaded was empty (0 bytes). Try some other records to confirm this.

dynamicdan commented 9 years ago

My latest commit fixes this and adds more support for logging errors (command line output in windows).

Note that I suspect it to be an Internet connection issue and not a 0 bytes received issue.

dynamicdan commented 9 years ago

Please download the latest version and test again. I improved the error handling. I also noticed that the restify module that we're using is a little outdated so I've add it to the road map to be upgraded.

jimser commented 9 years ago

Hi, thanks for the changes. Now I get the following:

No connection available (do we have internet?)
details: {"code":"ENOTFOUND","errno":"ENOTFOUND","syscall":"getaddrinfo","body"
{}}
Error: [Error: No connection available (do we have internet?)
details: {"code":"ENOTFOUND","errno":"ENOTFOUND","syscall":"getaddrinfo","body"
{}}]
  context: { table: 'sys_script',
  field: 'script',
  query: 'name=mark_closed' }

But I can confirm that my internet connection is working. And the business rule I tried to sync (mark_closed) is definitely not empty.

dynamicdan commented 9 years ago

Hmm. That is strange.

I had some people test on windows recently and didn't have an issue. If its a connection issue then there are a few standard things we'll need to check.

Are your settings correct? Can you use a rest client with the same settings and it works? Is your instance on http or https? I presume you only enter the domain in your config (bla.servicenow.com)?

Do you have any special internet or security settings set? I know windows have heaps of those things. Try disabling your firewall or proxies. IPv4 or 6?

Does it happen on all connections? Try a different internet connection. Eg, 3G or other network.

If you still can't resolve it then we have 2 options.

  1. Try installing on another system or ask someone else to try.
  2. I update the restify node module to its latest version. I've been meaning to do this anyway. Perhaps you can try this too and let me know if it helps. npm update should use the new package.json file. You may need to tweak the required versions though.
dynamicdan commented 9 years ago

One more thing.

You need to first download the the record using the tool. You first need to create a 0 bytes file with a name matching the record name with the appropriate suffix (.js in your case) and in the right folder business_rules.

It won't work the other way by design due to syncing restrictions. So first try and get that file filled from the instance.

jimser commented 9 years ago

Now it works :-)

I removed the "https://" from the host string. Thank you very much for your help.