huserben / TfsExtensions

Extensions for TFS 2015+ such as custom Widgets (require TFS 2017) and Build Tasks
MIT License
45 stars 22 forks source link

Error regarding Unexpected token #55

Closed bi-pavlo-pryimak closed 6 years ago

bi-pavlo-pryimak commented 6 years ago

Today the error appeared regarding "Unexpected token". I refreshed Personal Token - but it didn't help.

Maybe VSTS api was changed? And some parsing errors appears....

Logs are next: 2018-02-26T11:31:08.2052890Z ============================================================================== 2018-02-26T11:31:08.2061750Z Task : Trigger Build 2018-02-26T11:31:08.2071240Z Description : This tasks allows to trigger a new Build (add it to the queue) as part of a Build Definition. It contains as well some conditions that can be applied, for example if the last build of certain definition was successful or not. 2018-02-26T11:31:08.2080780Z Version : 2.6.0 2018-02-26T11:31:08.2089430Z Author : Benjamin Huser 2018-02-26T11:31:08.2098010Z Help : 2018-02-26T11:31:08.2107200Z ============================================================================== 2018-02-26T11:31:08.4969930Z /home/vsts_agent/myagent/_work/_tasks/TriggerBuild_32abcf98-0df6-4711-b2e4-66a405d3c1a6/2.6.0/node_modules/linqts/dist/linqts.js:1 2018-02-26T11:31:08.4991230Z (function (exports, require, module, filename, dirname) { const e=e=>"object"==typeof e,t=(t,r)=>Object.keys(t).every(n=>e(t[n])?(void 0)._equal(r[n],t[n]):r[n]===t[n]),r=e=>(...t)=>!e(...t);class n{constructor(e=[]){this._elements=e}Add(e){this._elements.push(e)}AddRange(e){this._elements.push(...e)}Aggregate(e,t){return this._elements.reduce(e,t)}All(e){return this._elements.every(e)}Any(e){return e?this._elements.some(e):this._elements.length>0}Average(e){return this.Sum(e)/this.Count(e)}Cast(){return new n(this._elements)}Concat(e){return new n(this._elements.concat(e.ToArray()))}Contains(e){return this._elements.some(t=>t===e)}Count(e){return e?this.Where(e).Count():this._elements.length}DefaultIfEmpty(e){return this.Count()?this:new n([e])}Distinct(){return this.Where((r,n,s)=>(e(r)?s.findIndex(e=>t(e,r)):s.indexOf(r))===n)}DistinctBy(e){const t=this.GroupBy(e,e=>e);re 2018-02-26T11:31:08.5000340Z 2018-02-26T11:31:08.5009700Z SyntaxError: Unexpected token ... 2018-02-26T11:31:08.5018840Z at exports.runInThisContext (vm.js:53:16) 2018-02-26T11:31:08.5027890Z at Module._compile (module.js:387:25) 2018-02-26T11:31:08.5036920Z at Object.Module._extensions..js (module.js:422:10) 2018-02-26T11:31:08.5045850Z at Module.load (module.js:357:32) 2018-02-26T11:31:08.5054750Z at Function.Module._load (module.js:314:12) 2018-02-26T11:31:08.5063600Z at Module.require (module.js:367:17) 2018-02-26T11:31:08.5072490Z at require (internal/module.js:16:19) 2018-02-26T11:31:08.5083530Z at Object. (/home/vsts_agent/myagent/_work/_tasks/TriggerBuild_32abcf98-0df6-4711-b2e4-66a405d3c1a6/2.6.0/node_modules/tfsrestservice/index.js:41:16) 2018-02-26T11:31:08.5094660Z at Module._compile (module.js:413:34) 2018-02-26T11:31:08.5103690Z at Object.Module._extensions..js (module.js:422:10) 2018-02-26T11:31:08.5899540Z ##[error]Exit code 1 returned from process: file name '/home/vsts_agent/myagent/externals/node/bin/node', arguments '"/home/vsts_agent/myagent/_work/_tasks/TriggerBuild_32abcf98-0df6-4711-b2e4-66a405d3c1a6/2.6.0/index.js"'.

huserben commented 6 years ago

Hi @pavlo-pryimak

hmm this is strange, it looks like it was not able to load a file the task is dependent on. You run this on VSTS? Could you try to uninstall and reinstall the Task? I've never seen this before so it's a bit hard to come up with a concrete solution. Definetly it is not a general problem, as I'm testing on VSTS with OAuth and Personal Access Tokens and my TestBuilds went through yesterday without a problem :-/

Studentblanchard commented 6 years ago

I am getting the same error. Using on prem TFS

huserben commented 6 years ago

I updated some of the dependency packages yesterday, maybe something there went wrong. I'm looking at this as soon as possible.

Sorry for the inconvenience.

huserben commented 6 years ago

Hi @pavlo-pryimak , @Studentblanchard

I just updloaded version 2.6.1 which reverted back to the old references of the dependencies. Can you please try to give it a go with this version and see if this works again?

Studentblanchard commented 6 years ago

TFS still hasn't downloaded the newest version, I'm not sure how to force it.

huserben commented 6 years ago

Hi @Studentblanchard I think on TFS you have to manually install the new version of the extension (however I'm not 100% sure, as I don't work with TFS).

bi-pavlo-pryimak commented 6 years ago

Hi @huserben

Thanks for quick response. Unfortunately, the error still exist:

2018-02-27T07:10:35.3433390Z ============================================================================== 2018-02-27T07:10:35.3442450Z Task : Trigger Build 2018-02-27T07:10:35.3452130Z Description : This tasks allows to trigger a new Build (add it to the queue) as part of a Build Definition. It contains as well some conditions that can be applied, for example if the last build of certain definition was successful or not. 2018-02-27T07:10:35.3461880Z Version : 2.6.2 2018-02-27T07:10:35.3471140Z Author : Benjamin Huser 2018-02-27T07:10:35.3479930Z Help : 2018-02-27T07:10:35.3488890Z ============================================================================== 2018-02-27T07:10:35.6304180Z /home/vsts_agent/myagent/_work/_tasks/TriggerBuild_32abcf98-0df6-4711-b2e4-66a405d3c1a6/2.6.2/node_modules/linqts/dist/linqts.js:1 2018-02-27T07:10:35.6320240Z (function (exports, require, module, filename, dirname) { const e=e=>"object"==typeof e,t=(t,r)=>Object.keys(t).every(n=>e(t[n])?(void 0)._equal(r[n],t[n]):r[n]===t[n]),r=e=>(...t)=>!e(...t);class n{constructor(e=[]){this._elements=e}Add(e){this._elements.push(e)}AddRange(e){this._elements.push(...e)}Aggregate(e,t){return this._elements.reduce(e,t)}All(e){return this._elements.every(e)}Any(e){return e?this._elements.some(e):this._elements.length>0}Average(e){return this.Sum(e)/this.Count(e)}Cast(){return new n(this._elements)}Concat(e){return new n(this._elements.concat(e.ToArray()))}Contains(e){return this._elements.some(t=>t===e)}Count(e){return e?this.Where(e).Count():this._elements.length}DefaultIfEmpty(e){return this.Count()?this:new n([e])}Distinct(){return this.Where((r,n,s)=>(e(r)?s.findIndex(e=>t(e,r)):s.indexOf(r))===n)}DistinctBy(e){const t=this.GroupBy(e,e=>e);re 2018-02-27T07:10:35.6331520Z 2018-02-27T07:10:35.6340700Z SyntaxError: Unexpected token ... 2018-02-27T07:10:35.6349760Z at exports.runInThisContext (vm.js:53:16) 2018-02-27T07:10:35.6358750Z at Module._compile (module.js:387:25) 2018-02-27T07:10:35.6367790Z at Object.Module._extensions..js (module.js:422:10) 2018-02-27T07:10:35.6376810Z at Module.load (module.js:357:32) 2018-02-27T07:10:35.6386560Z at Function.Module._load (module.js:314:12) 2018-02-27T07:10:35.6395720Z at Module.require (module.js:367:17) 2018-02-27T07:10:35.6405370Z at require (internal/module.js:16:19) 2018-02-27T07:10:35.6416540Z at Object. (/home/vsts_agent/myagent/_work/_tasks/TriggerBuild_32abcf98-0df6-4711-b2e4-66a405d3c1a6/2.6.2/node_modules/tfsrestservice/index.js:41:16) 2018-02-27T07:10:35.6427640Z at Module._compile (module.js:413:34) 2018-02-27T07:10:35.6437060Z at Object.Module._extensions..js (module.js:422:10) 2018-02-27T07:10:35.7257140Z ##[error]Exit code 1 returned from process: file name '/home/vsts_agent/myagent/externals/node/bin/node', arguments '"/home/vsts_agent/myagent/_work/_tasks/TriggerBuild_32abcf98-0df6-4711-b2e4-66a405d3c1a6/2.6.2/index.js"'.

huserben commented 6 years ago

Hi @pavlo-pryimak

did you try un- and reinstall the task? It's really hard to tell where the issue could be, I've run it on my VSTS instance, I even added a hosted agent that was completly blank and ran it there and I did not manage to run into this issue.

Sorry I cannot help more at the moment. The only other option would be to properly update all the packages again and see if this would help.

huserben commented 6 years ago

Another option could, I'll provide you the VSIX of the extension and you can install it yourself for testing purposes. Otherwise I need to always update the task for everybody and go via the marketplace. While we are trying to nail down the concrete problem this would be more meaningful I believe.

Prerequisite is that you have the necessary rights on your TFS/VSTS Instance.

What do you think @pavlo-pryimak , @Studentblanchard ?

Studentblanchard commented 6 years ago

I have the permissions but I won't have time until later this week. For now I've forced TFS to use the 2.5.* version.

bi-pavlo-pryimak commented 6 years ago

@huserben reinstalling the extension didn't work also.

Also I don't have necessary rights to debug all thoroughly.

Nevertheless, thanks.

huserben commented 6 years ago

ok, then I could provide the VSIX package to @Studentblanchard and he could try to run it. Once this is the case we could assume it works again as well for you @pavlo-pryimak and then I would upload it to the marketplace in the hope that it fixes your issue.

Another option would be to maybe check with some VSTS guys if they know anything about the issue?

Paul-Clewell commented 6 years ago

I'm also experiencing this issue. It appears that, as previously stated, it is occurring with a personal access token. I'm unsure what the trigger of the issue seems to be, but you guys appear to have been over this already.

Though I'm curious about the VSIX package you're referring to @huserben.

Studentblanchard commented 6 years ago

Could this be an issue with the linqts node module? I see in release version 2.6.0 you upgraded that node module from 1.10.0 => 1.10.1. Unminified the error comes from the following line in linqts.js (3)

r=e=>(...t)=>!e(...t)

I am not a javascript programmer by any means, maybe someone here with more JS/TS experience can weigh in?

huserben commented 6 years ago

I think it's the linqts module, I cannot really believe that the PAT / Authentication in general has any impact. That's why in 2.6.1 I went back to 1.10.0. However that did not seem to help.

Just for the sake of it, could one of you try to switch to OAuth authentication and retry?

As well I'll attached the vsix package which includes updates pacakges of everything, maybe there is/was some issue with dependent packages... Please let me know if anyone was able to test it on your TFS/VSTS Instances. benjhuser.tfs-extensions-build-tasks-2.6.3.vsix.zip

TimSiefert commented 6 years ago

I got the same issue on my TFS on premise "Microsoft Visual Studio Team Foundation Server Version 15.117.26714.0".

2018-02-28T21:23:38.4471815Z T:\TFS2015_BuildAgent\tasks\TriggerBuild\2.6.2\node_modules\linqts\dist\linqts.js:1 2018-02-28T21:23:38.4627791Z (function (exports, require, module, filename, dirname) { const e=e=>"object"==typeof e,t=(t,r)=>Object.keys(t).every(n=>e(t[n])?(void 0)._equal(r[n],t[n]):r[n]===t[n]),r=e=>(...t)=>!e(...t);class n{constructor(e=[]){this._elements=e}Add(e){this._elements.push(e)}AddRange(e){this._elements.push(...e)}Aggregate(e,t){return this._elements.reduce(e,t)}All(e){return this._elements.every(e)}Any(e){return e?this._elements.some(e):this._elements.length>0}Average(e){return this.Sum(e)/this.Count(e)}Cast(){return new n(this._elements)}Concat(e){return new n(this._elements.concat(e.ToArray()))}Contains(e){return this._elements.some(t=>t===e)}Count(e){return e?this.Where(e).Count():this._elements.length}DefaultIfEmpty(e){return this.Count()?this:new n([e])}Distinct(){return this.Where((r,n,s)=>(e(r)?s.findIndex(e=>t(e,r)):s.indexOf(r))===n)}DistinctBy(e){const t=this.GroupBy(e,e=>e);return Object.keys(t).reduce((e,r)=>(e.Add(t[r][0 2018-02-28T21:23:38.4627791Z SyntaxError: Unexpected token ... 2018-02-28T21:23:38.4627791Z at exports.runInThisContext (vm.js:53:16) 2018-02-28T21:23:38.4627791Z at Module._compile (module.js:387:25) 2018-02-28T21:23:38.4627791Z at Object.Module._extensions..js (module.js:422:10) 2018-02-28T21:23:38.4627791Z at Module.load (module.js:357:32) 2018-02-28T21:23:38.4627791Z at Function.Module._load (module.js:314:12) 2018-02-28T21:23:38.4627791Z at Module.require (module.js:367:17) 2018-02-28T21:23:38.4627791Z at require (internal/module.js:16:19) 2018-02-28T21:23:38.4627791Z at Object. (T:\TFS2015_BuildAgent\tasks\TriggerBuild\2.6.2\node_modules\tfsrestservice\index.js:41:16) 2018-02-28T21:23:38.4627791Z at Module._compile (module.js:413:34) 2018-02-28T21:23:38.4627791Z at Object.Module._extensions..js (module.js:422:10)

It tried it which the OAuth and Basic Credentials mechanism. Both method generate the same error

huserben commented 6 years ago

Hi all

sorry I'm quite busy at work and did not have time too further look into the issue. So now at least we are clear that it has nothing to do with the Authentication method.

Could someone provide me the complete folder of the task from the build agent (e.g. for @TimSiefert it would be _T:\TFS2015BuildAgent\tasks\TriggerBuild\2.6.2).

Another question, are you all using TFS 2015? Can we narrow it down to this? Could you as well provide me the version of node that is installed on your agent (type in the comand line node --version).

Studentblanchard commented 6 years ago

node version 6.9.1

Studentblanchard commented 6 years ago

2.6.2.zip And yes I am using TFS 2015 (Version 15.117.26526.0)

TimSiefert commented 6 years ago

I have the node version 6.11.1 It is an TFS 2017 with an relatively old build agent (from tfs2015 I think).

Agent.OS | Windows_NT Agent.OSVersion | 6.3.9600 Agent.Version | 1.105.6

huserben commented 6 years ago

Ok, i'm starting to get out of ideas :-(

I downloaded the zip you provided @Studentblanchard and it works on my local machine. So it has to be some setting from the build agent. However my build agent in use where the task works uses as well verison 6.9.1 of node...

Could you maybe try to update your agent if you have the permissions to do so:

In the meantime I'm trying to get my hands on a TFS Install to see if i can reproduce it somehow like this...

huserben commented 6 years ago

I know uploaded version 2.6.3 where I aligned the versions of the dependencies of the tasks so they are updated to the newest, and they are aligned with the version of the underlying service.

Could someone give this a try and let me know if it helped...?

Studentblanchard commented 6 years ago

screenshot_1

Updated my agents. This is the new version. Still fails on the task (2.6.2)

huserben commented 6 years ago

Hi

I updated the tasks now by specifying to use exactly version 1.10.0 (the one that was working before) as suggested in the issue in opened over at the linqts repo.

Can someone please give it a try with version 2.6.4 that includes the changes?

bi-pavlo-pryimak commented 6 years ago

Version 2.6.4 worked in my case.

Paul-Clewell commented 6 years ago

This also resolved my issue. Thanks!

Studentblanchard commented 6 years ago

It's working for me as well. Thanks @huserben!

huserben commented 6 years ago

Hi

that's very good to hear, if you @TimSiefert could confirm it as well I will close the issue.

Thanks for your patience and please don't hesitate to open new issues if you run into problems or have suggestions for extending/changing the task.

bi-pavlo-pryimak commented 6 years ago

Hi @huserben, thanks for support!

Feel free to close the issue.

TimSiefert commented 6 years ago

Sorry for the late response. Now it is working for me as well. Thank you!