Closed stephen-nba closed 7 years ago
Hi @stephen-nba ,
You can try running your command with --log trace
, for example appbuilder build android --log trace
, which should give you more verbose output.
At the moment you cannot provide username and password for your proxy, but it should be sufficient just to login (in your browser or anywhere else) in your proxy.
Also it looks like you've stuck on enabling/disabling usage reporting. You can try running:
$ appbuilder usage-reporting disable
$ appbuilder error-reporting disable
This will stop requests to our analytics server.
Ironically disabling the error and usage reporting returns the very same error.
Here is the trace log, looks like it is a 501 from your server?
appbuilder build android --log trace Exec npm -v stdout: 3.8.6
stderr: spawn: java "-version" Exec node-gyp -v stdout: stderr: 'node-gyp' is not recognized as an internal or external command, operable program or batch file.
Exec "adb" version stdout: Android Debug Bridge version 1.0.32 Revision 57224c5cff69-android
stderr: spawn: android.bat "-h" Exec mono --version stdout: stderr: 'mono' is not recognized as an internal or external command, operable program or batch file.
Exec git --version stdout: git version 2.8.1.windows.1
stderr: Exec gradle -v stdout: stderr: 'gradle' is not recognized as an internal or external command, operable program or batch file.
Exec "javac" -version stdout: stderr: '"javac"' is not recognized as an internal or external command, operable program or batch file.
System information: { procInfo: 'appbuilder/3.3.2', platform: 'win32', os: 'Windows 7 Professional 6.1.7601', shell: 'C:\Windows\system32\cmd.exe', dotNetVer: '4.6.01055', procArch: 'x64', nodeVer: 'v5.12.0', npmVer: '3.8.6', javaVer: '1.6.0', nodeGypVer: null, xcodeVer: null, xcodeprojGemLocation: null, itunesInstalled: true, cocoapodVer: null, adbVer: 'Android Debug Bridge version 1.0.32', androidInstalled: '', monoVer: null, gitVer: '2.8.1.windows.1', gradleVer: null, javacVersion: null } Starting watch on killswitch C:\Users[MyUser]\AppData\Local\Temp[MyUser]\Kill Switches\cli Looking for project in 'C:\Code[MyAppRoot]\Trunk\Mobile[MyAppName]' Project directory is 'C:\Code[MyAppRoot]\Trunk\Mobile[MyAppName]'. Do you want to help us improve Telerik AppBuilder by automatically sending anony mous usage statistics? We will not use this information to identify or contact y ou. You can read our official Privacy Policy at ? http://www.telerik.com/company/privacy-policy: No Using proxy with host: [MyProxy], port: 8080, path is: http://registry.npmjs. org/appbuilder User-Agent: AppBuilderCLI/3.3.2 (Node.js 5.12.0; win32; x64) httpRequest: { method: 'GET', host: '[MyProxy]', port: 8080, path: 'http://registry.npmjs.org/appbuilder', headers: { Host: 'registry.npmjs.org', Accept: 'application/json; charset=UTF-8, /;q=0.8', 'User-Agent': 'AppBuilderCLI/3.3.2 (Node.js 5.12.0; win32; x64)', 'Accept-Encoding': 'gzip,deflate' } } httpRequest: Sending: [no content] httpRequest: Done. code = 200 Using proxy with host: [MyProxy], port: 8080, path is: https://platform.teler ik.com/appbuilder/api/rawSettings/currentUser httpRequest: { host: '[MyProxy]', path: 'https://platform.telerik.com/appbuilder/api/rawSettings/currentUser', method: 'GET', headers: { 'X-Icenium-SolutionSpace': 'Private_BuildFolder', Cookie: 'tlrkappshell=[SomeCookieCode]', Accept: 'application/octet-stream, application/json; charset=UTF-8, /_;q=0 .8', Host: 'platform.telerik.com', 'User-Agent': 'AppBuilderCLI/3.3.2 (Node.js 5.12.0; win32; x64)', 'Accept-Encoding': 'gzip,deflate' }, port: 8080 } httpRequest: Sending: [no content] httpRequest: Done. code = 501 Error: The server returned unexpected response: SyntaxError: Unexpected token < at FiberFuture.Future.wait (C:\Users[MyUser]\AppData\Roaming\npm\node_modu les\appbuilder\node_modules\fibers\future.js:535:15) at C:\Users[MyUser]\AppData\Roaming\npm\node_modules\appbuilder\lib\common \errors.js:123:33 at Function.settle (C:\Users[MyUser]\AppData\Roaming\npm\node_modules\appb uilder\node_modules\fibers\future.js:249:26) at FiberFuture.Future.wait (C:\Users[MyUser]\AppData\Roaming\npm\node_modu les\appbuilder\node_modules\fibers\future.js:534:10) at C:\Users[MyUser]\AppData\Roaming\npm\node_modules\appbuilder\lib\common \services\commands-service.js:84:106 at Function.settle (C:\Users[MyUser]\AppData\Roaming\npm\node_modules\appb uilder\node_modules\fibers\future.js:249:26) at FiberFuture.Future.wait (C:\Users[MyUser]\AppData\Roaming\npm\node_modu les\appbuilder\node_modules\fibers\future.js:534:10) at C:\Users[MyUser]\AppData\Roaming\npm\node_modules\appbuilder\lib\common \dispatchers.js:38:85 at Function.settle (C:\Users[MyUser]\AppData\Roaming\npm\node_modules\appb uilder\node_modules\fibers\future.js:249:26) at FiberFuture.Future.wait (C:\Users[MyUser]\AppData\Roaming\npm\node_modu les\appbuilder\node_modules\fibers\future.js:534:10) at C:\Users[MyUser]\AppData\Roaming\npm\node_modules\appbuilder\lib\appbui lder-cli.js:21:45 at C:\Users[MyUser]\AppData\Roaming\npm\node_modules\appbuilder\lib\common \fiber-bootstrap.js:10:13
at IncomingMessage.<anonymous> (C:\Users[MyUser]\AppData\Roaming\npm\node_
modules\appbuilder\lib\common\http-client.js:120:44) at emitNone (events.js:85:20) at IncomingMessage.emit (events.js:179:7) at endReadableNT (_stream_readable.js:913:12) at _combinedTickCallback (internal/process/next_tick.js:74:11) at process._tickCallback (internal/process/next_tick.js:98:9) Error reporting will be enabled. You can disable it by running '$ appbuilder err or-reporting disable'. Using proxy with host: [MyProxy], port: 8080, path is: https://platform.teler ik.com/appbuilder/api/rawSettings/currentUser httpRequest: { host: '[MyProxy]', path: 'https://platform.telerik.com/appbuilder/api/rawSettings/currentUser', method: 'GET', headers: { 'X-Icenium-SolutionSpace': 'Private_BuildFolder', Cookie: 'tlrkappshell=[SomeCookieCode]', Accept: 'application/octet-stream, application/json; charset=UTF-8, /_;q=0 .8', Host: 'platform.telerik.com', 'User-Agent': 'AppBuilderCLI/3.3.2 (Node.js 5.12.0; win32; x64)', 'Accept-Encoding': 'gzip,deflate' }, port: 8080 } httpRequest: Sending: [no content] httpRequest: Done. code = 501 Error: The server returned unexpected response: SyntaxError: Unexpected token < at FiberFuture.Future.wait (C:\Users[MyUser]\AppData\Roaming\npm\node_modu les\appbuilder\node_modules\fibers\future.js:535:15) at C:\Users[MyUser]\AppData\Roaming\npm\node_modules\appbuilder\lib\appbui lder-cli.js:21:45 at C:\Users[MyUser]\AppData\Roaming\npm\node_modules\appbuilder\lib\common \fiber-bootstrap.js:10:13
at IncomingMessage.<anonymous> (C:\Users[MyUser]\AppData\Roaming\npm\node_
modules\appbuilder\lib\common\http-client.js:120:44) at emitNone (events.js:85:20) at IncomingMessage.emit (events.js:179:7) at endReadableNT (_stream_readable.js:913:12) at _combinedTickCallback (internal/process/next_tick.js:74:11) at process._tickCallback (internal/process/next_tick.js:98:9) Initializing analytics statuses. Analytics statuses: { 'AnalyticsSettings.TrackFeatureUsage': 1, 'AnalyticsSettings.TrackExceptions': 2 } Trying to track exception with message 'The server returned unexpected response: SyntaxError: Unexpected token <'.
I tried setting the fiddler proxy as listed here:
https://github.com/Icenium/icenium-cli/blob/master/for-developers.md#fiddler
by creating the setting, but it didn't seem to work. Should it work in conjunction with a custom proxy?
Hi guys, still getting this issue. If I go to
https://platform.telerik.com/appbuilder/api/rawSettings/currentUser/user-settings.xml
im my web browser I get
<?xml version="1.0" encoding="UTF-8"?>
<JustDevelopSettings>
<AnalyticsSettings xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<TrackExceptions>true</TrackExceptions>
<TrackFeatureUsage i:nil="true"/>
</AnalyticsSettings>
<AndroidEmulatorSettings xmlns:i="http://
etc. etc. are you sure that isn't the problem? Eg. it definately returns XML, but the error states that it is not expecting an angle bracket??
And (as i'm sure you are seeing in your logs) if I run
appbuilder logout
Then
appbuilder doctor
I get
$ appbuilder doctor
WARNING: The Android SDK is not installed or is not configured properly.
You will not be able to run your apps in the native emulator. To be able to run apps
in the native Android emulator, verify that you have installed the latest Android SDK
and its dependencies as described in http://developer.android.com/sdk/index.html#Requirements
TIP: To avoid setting up the necessary environment variables, you can use the chocolatey package manager to install the Android SDK and its dependencies.
When you file an issue, these warnings will help the AppBuilder team to investigate, identify, and resolve the report.
Please, ignore them if you are not experiencing any issues with AppBuilder.
If I log in again, then run anything I get the same angle bracket error. So it is something that only happens when logged in...
Hi @stephen-nba ,
The error SyntaxError: Unexpected token <'.
indicates that result code is not success and the returned result is not JSON. It looks like this happens when CLI tries to get the logged in user from our server. In case the result is 200, the content you see in your browser ( when opening https://platform.telerik.com/appbuilder/api/rawSettings/currentUser/user-settings.xml ) will be parsed correctly. However when CLI encounters receives error code for the response (for example 500), it tries to parse the body of the response and this operation fails. In order to see the body of the response you should modify <appbuilder installation dir>/lib/common/http-client.js
. Find the catch on line 198 and modify it this way:
catch (parsingFailed) {
console.log(body.toString());
return "The server returned unexpected response: " + parsingFailed.toString();
}
This way you'll see the body of the failed response. This will help us to resolve the issue, so please give it a try.
Also I would like to explain the current logic of using proxy with AppBuilder CLI. As you already know, you have to modify <appbuilder installation dir>/config/config.json
file to set three properties:
"USE_PROXY": false,
"PROXY_HOSTNAME": "127.0.0.1",
"PROXY_PORT": 8888,
When sending any requests, in case USE_PROXY is set to true, CLI will modify the request, so it will be passed to the proxy and the real request url will be included in the headers of the request.
When CLI makes requests to registry.npmjs.org, it uses the proxy set for npm (the result of npm config get proxy
). However I believe you are not in this case as obviously you are unable to execute any command when you are logged in.
When you are not logged in, CLI does not execute the request to get the current user, that's why you are able to execute limited number of commands.
My best suggestion here is that your proxy needs authentication, but currently there's no way to authenticate your request via AppBuilder CLI. You can try the following:
1) Open your default browser.
2) Try authenticating in your proxy (you can ask your admins for more information on this step).
3) Set correct proxy settings in your config.json file.
4) Set USE_PROXY to true in the config.json
5) Modify the code in <appbuilder installation dir>/lib/common/http-client.js
as described above.
6) Try $ appbuilder login
and check the body result in case it fails again.
Hope this helps.
Hi
I have modified as suggested. Here is my output, also using the debug flag:
$ appbuilder doctor Exec npm -v stdout: 3.10.3
stderr: spawn: java "-version" Exec node-gyp -v stdout: stderr: 'node-gyp' is not recognized as an internal or external command, operable program or batch file.
Exec "adb" version stdout: Android Debug Bridge version 1.0.32 Revision 57224c5cff69-android
stderr: spawn: android.bat "-h" Exec mono --version stdout: stderr: 'mono' is not recognized as an internal or external command, operable program or batch file.
Exec git --version stdout: git version 2.9.0.windows.1
stderr: Exec gradle -v stdout: stderr: 'gradle' is not recognized as an internal or external command, operable program or batch file.
Exec "javac" -version stdout: stderr: '"javac"' is not recognized as an internal or external command, operable program or batch file.
System information: { procInfo: 'appbuilder/3.6.0', platform: 'win32', os: 'Windows 7 Professional 6.1.7601', shell: 'C:\Windows\system32\cmd.exe', dotNetVer: '4.6.01590', procArch: 'ia32', nodeVer: 'v6.3.1', npmVer: '3.10.3', javaVer: '1.6.0', nodeGypVer: null, xcodeVer: null, xcodeprojGemLocation: null, itunesInstalled: true, cocoapodVer: null, adbVer: 'Android Debug Bridge version 1.0.32', androidInstalled: '', monoVer: null, gitVer: '2.9.0.windows.1', gradleVer: null, javacVersion: null } Starting watch on killswitch C:\Users[MyUser]\AppData\Local\Temp\contwells\KillSwitches\cli Looking for project in 'C:\Code[MyCodeFolder]' Project directory is 'C:\Code[MyCodeFolder]'. Do you want to help us improve Telerik AppBuilder by automatically sending anonymous usage statistics? We will not use this information to identify or contact you. You can read our official Privacy Policy at ? http://www.telerik.com/company/privacy-policy: Yes Exec npm config get registry stdout: http://registry.npmjs.org/
stderr: Npm registry is: http://registry.npmjs.org/. Exec npm config get proxy stdout: http://[ProxyIp]:8080/
stderr: Npm proxy is: { hostname: '[ProxyIp]', port: '8080' } Using proxy with host: [ProxyIp], port: 8080, path is: http://registry.npmjs.org/appbuilder?version=latest User-Agent: AppBuilderCLI/3.6.0 (Node.js 6.3.1; win32; ia32) httpRequest: { host: '[ProxyIp]', port: '8080', path: 'http://registry.npmjs.org/appbuilder?version=latest', headers: { Host: 'registry.npmjs.org', Accept: 'application/json; charset=UTF-8, /;q=0.8', 'User-Agent': 'AppBuilderCLI/3.6.0 (Node.js 6.3.1; win32; ia32)', 'Accept-Encoding': 'gzip,deflate' } } httpRequest: Sending: [no content] httpRequest: Done. code = 200 Using proxy with host: [ProxyIp], port: 8080, path is: https://platform.telerik.com/appbuilder/api/rawSettings/currentUser/user-settings.xml
httpRequest: { host: '[ProxyIp]', path: 'https://platform.telerik.com/appbuilder/api/rawSettings/currentUser/user-settings.xml', method: 'GET', headers: { 'X-Icenium-SolutionSpace': 'Private_Build_Folder', Cookie: 'tlrkappshell=[PrivateCookieIPresume]', Accept: 'application/octet-stream, application/json; charset=UTF-8, /;q=0.8', Host: 'platform.telerik.com', 'User-Agent': 'AppBuilderCLI/3.6.0 (Node.js 6.3.1; win32; ia32)', 'Accept-Encoding': 'gzip,deflate' }, port: 8080 } httpRequest: Sending: [no content] httpRequest: Done. code = 501 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/tr/1999/REC-html401-19991224/loose.dtd">
|
Error: The server returned unexpected response: SyntaxError: Unexpected token < in JSON at position 0 at FiberFuture.Future.wait (C:\Users\contwells\AppData\Roaming\npm\node_modules\appbuilder\node_modules\fibers\future.js:566:15) at C:\Users\contwells\AppData\Roaming\npm\node_modules\appbuilder\lib\common\errors.js:128:33 at Function.settle (C:\Users\contwells\AppData\Roaming\npm\node_modules\appbuilder\node_modules\fibers\future.js:249:26) at FiberFuture.Future.wait (C:\Users\contwells\AppData\Roaming\npm\node_modules\appbuilder\node_modules\fibers\future.js:565:10) at C:\Users\contwells\AppData\Roaming\npm\node_modules\appbuilder\lib\common\services\commands-service.js:84:106 at Function.settle (C:\Users\contwells\AppData\Roaming\npm\node_modules\appbuilder\node_modules\fibers\future.js:249:26) at FiberFuture.Future.wait (C:\Users\contwells\AppData\Roaming\npm\node_modules\appbuilder\node_modules\fibers\future.js:565:10) at C:\Users\contwells\AppData\Roaming\npm\node_modules\appbuilder\lib\common\dispatchers.js:38:85 at Function.settle (C:\Users\contwells\AppData\Roaming\npm\node_modules\appbuilder\node_modules\fibers\future.js:249:26) at FiberFuture.Future.wait (C:\Users\contwells\AppData\Roaming\npm\node_modules\appbuilder\node_modules\fibers\future.js:565:10) at C:\Users\contwells\AppData\Roaming\npm\node_modules\appbuilder\lib\appbuilder-cli.js:21:45 at C:\Users\contwells\AppData\Roaming\npm\node_modules\appbuilder\lib\common\fiber-bootstrap.js:10:13
at IncomingMessage.<anonymous> (C:\[,...]\appbuilder\lib\common\http-client.js:115:39)
at emitNone (events.js:91:20)
at IncomingMessage.emit (events.js:185:7)
at endReadableNT (_stream_readable.js:975:12)
at _combinedTickCallback (internal/process/next_tick.js:74:11)
at process._tickCallback (internal/process/next_tick.js:98:9)
The main error seems to be:
"Unsupported Request Method and Protocol"
So it is definitely something with my proxy. I did a quick google and it says that Squid doesn't accept CONNECT over https? But the request is definately a GET. I don't know enough about networking to figure this one out!
If I have a good question for the IT guys I can ask, but at first glance a GET over HTTPS is supported, so there must be something else going on.
Anyway, not really an AppBuilder issue in the end, but happy for you to help!
Hey @stephen-nba ,
It's definitely an issue with the proxy, but I'm not sure it's the configuration on your side. Maybe your IT guys have to allow access to platform.telerik.com
. I've noticed that the first request that CLI executes to registry.npmjs.org is successful, but the one to platform.telerik.com
is not. So there are several possible reasons for this:
1) Your admins allow connection to registry.npmjs.org
, but do not allow connection to platform.telerik.com
.
2) The proxy allows connection over http
, but does not allow connection over https
- from the logs I've noticed that the request to registry.npmjs.org is over http, while the request to platform.telerik.com is over https. You can try modifying the <appbuilder installation dir>/config/config.json
AB_SERVER_PROTO to "http" and see if you are able to connect.
3) The proxy configuration is different in your npm config and in AppBuilder's config. Can you verify the proxy is the same on both sides.
Hope this will give you enough information, so your admins will be able to identify the issue.
Well, I got it half working. If I run Fiddler and use it as an intermediate proxy, it actually works!
I think that the issue is with a CONNECT http verb, as fiddler says
Tunnel To: platform.telerik.com:443 CONNECT platform.telerik.com:443 HTTP/1.1 Host: platform.telerik.com:443 User-Agent: AppBuilderCLI/3.6.1 (Node.js 6.3.1; win32; ia32)
I don't know what tunneling is or why it needs to do it, but it does a CONNECT which I am guessing the Squid proxy doesn't allow but somehow Fiddler helps and makes it work.
Anyway, it's not much of a solution as I can't have Fiddler running all the time when I want to use the CLI, nor can I expect the other Devs to do the same.
Maybe I'll chase down the Fiddler support guys to see why it works through Fiddler and not regularly.
Cheers!
Hi
I have set up a proxy for appbuilder cli as documented here:
https://github.com/Icenium/icenium-cli#configure-proxy-usage
but now literally every command returns:
Is there a way to see what the response is? There is a chance it is prompting for credentials, so the response might be a 403 from the proxy. The question then is, how can I provide a user/pass to the proxy through the appbuilder config file?