Skip to content

no_proxy support #2313

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
spike1292 opened this issue Dec 5, 2016 · 6 comments · Fixed by #4565
Closed

no_proxy support #2313

spike1292 opened this issue Dec 5, 2016 · 6 comments · Fixed by #4565

Comments

@spike1292
Copy link

When i set the proxy according to https://github.com/NativeScript/nativescript-cli#configure-proxy-usage the running the unit tests runner will also proxy the localhost calls. This is giving me problems in combination with the corporate proxy.

It would be very nice if the nativescript-cli will correctly honor the ENV variables for http_proxy, https_proxy and no_proxy.

Support for no_proxy in the config.json would also be very great!

@NickIliev
Copy link
Contributor

NickIliev commented Dec 5, 2016

@spike1292 you can set USE_PROXY = false in your config.json, no?

@spike1292
Copy link
Author

spike1292 commented Dec 5, 2016

This is not possible, without the proxy the nativescript-cli the tns prepare breaks, because it is trying to fetch external resources.

btw i'm running this on a build slave

@valentinstoychev valentinstoychev added this to the 2.6.0 (TBD) milestone Dec 6, 2016
@pkoleva pkoleva removed the T:Feature label Jan 26, 2017
@pkoleva pkoleva modified the milestone: 2.6.0 (TBD) Jan 26, 2017
@NiketanMhatre
Copy link

If you could add ProxyUsername and ProxyPassword labels in .json file that will help in explicit proxy settings. Some corporate proxy needs user authentication to download.

@dtopuzov
Copy link
Contributor

dtopuzov commented May 4, 2017

@spike1292 @NiketanMhatre Can you please try with {N} 3.0.0 and tns proxy set command.
Help: tns help proxy set

Please let us know if you still experience the issue.

@spike1292
Copy link
Author

@dtopuzov the problem isn't solved yet.

How to reproduce:

Then I get the following stacktrace
tns test ios --emulator --justlaunch --log trace
Loading extensions.
execFile: /usr/local/share/android-sdk/platform-tools/adb "help"
Exec uname -a
 stdout: Darwin Henks-MacBook-Pro.local 16.5.0 Darwin Kernel Version 16.5.0: Fri Mar  3 16:52:33 PST 2017; root:xnu-3789.51.2~3/RELEASE_X86_64 x86_64

 stderr:
Exec npm -v
 stdout: 4.4.4

 stderr:
spawn: java "-version"
Exec node-gyp -v
 stdout:
 stderr: /bin/sh: node-gyp: command not found

Exec xcodebuild -version
 stdout: Xcode 8.2.1
Build version 8C1002

 stderr:
Exec gem which xcodeproj
 stdout: /usr/local/opt/rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/xcodeproj-1.4.4/lib/xcodeproj.rb

 stderr:
Exec pod --version
 stdout: 1.2.0

 stderr:
Exec '/usr/local/share/android-sdk/platform-tools/adb' version
 stdout: Android Debug Bridge version 1.0.39
Revision 5943271ace17-android

 stderr:
spawn: /usr/local/share/android-sdk/emulator/emulator "-help"
Result when throw error is false:
{ stdout: 'Android Emulator usage: emulator [options] [-qemu args]\n  options:\n    -list-avds                     list available AVDs\n    -sysdir <dir>                  search for system disk images in <dir>\n    -system <file>                 read initial system image from <file>\n    -writable-system               make system image writable after \'adb remount\'\n    -datadir <dir>                 write user data into <dir>\n    -kernel <file>                 use specific emulated kernel\n    -ramdisk <file>                ramdisk image (default <system>/ramdisk.img\n    -image <file>                  obsolete, use -system <file> instead\n    -initdata <file>               same as \'-init-data <file>\'\n    -data <file>                   data image (default <datadir>/userdata-qemu.img\n    -partition-size <size>         system/data partition size in MBs\n    -cache <file>                  cache partition image (default is temporary file)\n    -cache-size <size>             cache partition size in MBs\n    -no-cache                      disable the cache partition\n    -nocache                       same as -no-cache\n    -sdcard <file>                 SD card image (default <datadir>/sdcard.img\n    -snapstorage <file>            file that contains all state snapshots (default <datadir>/snapshots.img)\n    -no-snapstorage                do not mount a snapshot storage file (this disables all snapshot functionality)\n    -snapshot <name>               name of snapshot within storage file for auto-start and auto-save (default \'default-boot\')\n    -no-snapshot                   perform a full boot and do not do not auto-save, but qemu vmload and vmsave operate on snapstorage\n    -no-snapshot-save              do not auto-save to snapshot on exit: abandon changed state\n    -no-snapshot-load              do not auto-start from snapshot: perform a full boot\n    -snapshot-list                 show a list of available snapshots\n    -no-snapshot-update-time       do not do try to correct snapshot time on restore\n    -wipe-data                     reset the user data image (copy it from initdata)\n    -avd <name>                    use a specific android virtual device\n    -skindir <dir>                 search skins in <dir> (default <system>/skins)\n    -skin <name>                   select a given skin\n    -no-skin                       deprecated: create an AVD with no skin instead\n    -noskin                        same as -no-skin\n    -memory <size>                 physical RAM size in MBs\n    -cores <number>                Set number of CPU cores to emulator\n    -accel <mode>                  Configure emulation acceleration\n    -no-accel                      Same as \'-accel off\'\n    -ranchu                        Use new emulator backend instead of the classic one\n    -engine <engine>               Select engine. auto|classic|qemu2\n    -netspeed <speed>              maximum network download/upload speeds\n    -netdelay <delay>              network latency emulation\n    -netfast                       disable network shaping\n    -code-profile <name>           enable code profiling\n    -show-kernel                   display kernel messages\n    -shell                         enable root shell on current terminal\n    -no-jni                        disable JNI checks in the Dalvik runtime\n    -nojni                         same as -no-jni\n    -logcat <tags>                 enable logcat output with given tags\n    -no-audio                      disable audio support\n    -noaudio                       same as -no-audio\n    -audio <backend>               use specific audio backend\n    -radio <device>                redirect radio modem interface to character device\n    -port <port>                   TCP port that will be used for the console\n    -ports <consoleport>,<adbport> TCP ports used for the console and adb bridge\n    -onion <image>                 use overlay PNG image over screen\n    -onion-alpha <%age>            specify onion-skin translucency\n    -onion-rotation 0|1|2|3        specify onion-skin rotation\n    -dpi-device <dpi>              specify device\'s resolution in dpi (default 165)\n    -scale <scale>                 scale emulator window (deprecated)\n    -http-proxy <proxy>            make TCP connections through a HTTP/HTTPS proxy\n    -timezone <timezone>           use this timezone instead of the host\'s default\n    -dns-server <servers>          use this DNS server(s) in the emulated system\n    -cpu-delay <cpudelay>          throttle CPU emulation\n    -no-boot-anim                  disable animation for faster boot\n    -no-window                     disable graphical window display\n    -version                       display emulator version number\n    -report-console <socket>       report console port to remote socket\n    -gps <device>                  redirect NMEA GPS to character device\n    -shell-serial <device>         specific character device for root shell\n    -tcpdump <file>                capture network packets to file\n    -bootchart <timeout>           enable bootcharting\n    -charmap <file>                use specific key character map\n    -prop <name>=<value>           set system property on boot\n    -shared-net-id <number>        join the shared network, using IP address 10.1.2.<number>\n    -nand-limits <nlimits>         enforce NAND/Flash read/write thresholds\n    -gpu <mode>                    set hardware OpenGLES emulation mode\n    -camera-back <mode>            set emulation mode for a camera facing back\n    -camera-front <mode>           set emulation mode for a camera facing front\n    -webcam-list                   lists web cameras available for emulation\n    -screen <mode>                 set emulated screen mode\n    -force-32bit                   always use 32-bit emulator\n    -selinux <disabled|permissive> Set SELinux to either disabled or permissive mode\n    -unix-pipe <path>              Add <path> to the list of allowed Unix pipes\n    -fixed-scale                   Use fixed 1:1 scale for the initial emulator window.\n    -wait-for-debugger             Pause on launch and wait for a debugger process to attach before resuming\n    -skip-adb-auth                 Skip adb authentication dialogue\n\n     -qemu args...                 pass arguments to qemu\n     -qemu -h                      display qemu help\n\n     -verbose                      same as \'-debug-init\'\n     -debug <tags>                 enable/disable debug messages\n     -debug-<tag>                  enable specific debug messages\n     -debug-no-<tag>               disable specific debug messages\n\n     -help                         print this help\n     -help-<option>                print option-specific help\n\n     -help-disk-images             about disk images\n     -help-debug-tags              debug tags for -debug <tags>\n     -help-char-devices            character <device> specification\n     -help-environment             environment variables\n     -help-virtual-device          virtual device management\n     -help-sdk-images              about disk images when using the SDK\n     -help-build-images            about disk images when building Android\n     -help-all                     prints all help content\n\n',
  stderr: '',
  exitCode: 0 }
The result of checking is Android Emulator installed is:
- stdout: Android Emulator usage: emulator [options] [-qemu args]
  options:
    -list-avds                     list available AVDs
    -sysdir <dir>                  search for system disk images in <dir>
    -system <file>                 read initial system image from <file>
    -writable-system               make system image writable after 'adb remount'
    -datadir <dir>                 write user data into <dir>
    -kernel <file>                 use specific emulated kernel
    -ramdisk <file>                ramdisk image (default <system>/ramdisk.img
    -image <file>                  obsolete, use -system <file> instead
    -initdata <file>               same as '-init-data <file>'
    -data <file>                   data image (default <datadir>/userdata-qemu.img
    -partition-size <size>         system/data partition size in MBs
    -cache <file>                  cache partition image (default is temporary file)
    -cache-size <size>             cache partition size in MBs
    -no-cache                      disable the cache partition
    -nocache                       same as -no-cache
    -sdcard <file>                 SD card image (default <datadir>/sdcard.img
    -snapstorage <file>            file that contains all state snapshots (default <datadir>/snapshots.img)
    -no-snapstorage                do not mount a snapshot storage file (this disables all snapshot functionality)
    -snapshot <name>               name of snapshot within storage file for auto-start and auto-save (default 'default-boot')
    -no-snapshot                   perform a full boot and do not do not auto-save, but qemu vmload and vmsave operate on snapstorage
    -no-snapshot-save              do not auto-save to snapshot on exit: abandon changed state
    -no-snapshot-load              do not auto-start from snapshot: perform a full boot
    -snapshot-list                 show a list of available snapshots
    -no-snapshot-update-time       do not do try to correct snapshot time on restore
    -wipe-data                     reset the user data image (copy it from initdata)
    -avd <name>                    use a specific android virtual device
    -skindir <dir>                 search skins in <dir> (default <system>/skins)
    -skin <name>                   select a given skin
    -no-skin                       deprecated: create an AVD with no skin instead
    -noskin                        same as -no-skin
    -memory <size>                 physical RAM size in MBs
    -cores <number>                Set number of CPU cores to emulator
    -accel <mode>                  Configure emulation acceleration
    -no-accel                      Same as '-accel off'
    -ranchu                        Use new emulator backend instead of the classic one
    -engine <engine>               Select engine. auto|classic|qemu2
    -netspeed <speed>              maximum network download/upload speeds
    -netdelay <delay>              network latency emulation
    -netfast                       disable network shaping
    -code-profile <name>           enable code profiling
    -show-kernel                   display kernel messages
    -shell                         enable root shell on current terminal
    -no-jni                        disable JNI checks in the Dalvik runtime
    -nojni                         same as -no-jni
    -logcat <tags>                 enable logcat output with given tags
    -no-audio                      disable audio support
    -noaudio                       same as -no-audio
    -audio <backend>               use specific audio backend
    -radio <device>                redirect radio modem interface to character device
    -port <port>                   TCP port that will be used for the console
    -ports <consoleport>,<adbport> TCP ports used for the console and adb bridge
    -onion <image>                 use overlay PNG image over screen
    -onion-alpha <%age>            specify onion-skin translucency
    -onion-rotation 0|1|2|3        specify onion-skin rotation
    -dpi-device <dpi>              specify device's resolution in dpi (default 165)
    -scale <scale>                 scale emulator window (deprecated)
    -http-proxy <proxy>            make TCP connections through a HTTP/HTTPS proxy
    -timezone <timezone>           use this timezone instead of the host's default
    -dns-server <servers>          use this DNS server(s) in the emulated system
    -cpu-delay <cpudelay>          throttle CPU emulation
    -no-boot-anim                  disable animation for faster boot
    -no-window                     disable graphical window display
    -version                       display emulator version number
    -report-console <socket>       report console port to remote socket
    -gps <device>                  redirect NMEA GPS to character device
    -shell-serial <device>         specific character device for root shell
    -tcpdump <file>                capture network packets to file
    -bootchart <timeout>           enable bootcharting
    -charmap <file>                use specific key character map
    -prop <name>=<value>           set system property on boot
    -shared-net-id <number>        join the shared network, using IP address 10.1.2.<number>
    -nand-limits <nlimits>         enforce NAND/Flash read/write thresholds
    -gpu <mode>                    set hardware OpenGLES emulation mode
    -camera-back <mode>            set emulation mode for a camera facing back
    -camera-front <mode>           set emulation mode for a camera facing front
    -webcam-list                   lists web cameras available for emulation
    -screen <mode>                 set emulated screen mode
    -force-32bit                   always use 32-bit emulator
    -selinux <disabled|permissive> Set SELinux to either disabled or permissive mode
    -unix-pipe <path>              Add <path> to the list of allowed Unix pipes
    -fixed-scale                   Use fixed 1:1 scale for the initial emulator window.
    -wait-for-debugger             Pause on launch and wait for a debugger process to attach before resuming
    -skip-adb-auth                 Skip adb authentication dialogue

     -qemu args...                 pass arguments to qemu
     -qemu -h                      display qemu help

     -verbose                      same as '-debug-init'
     -debug <tags>                 enable/disable debug messages
     -debug-<tag>                  enable specific debug messages
     -debug-no-<tag>               disable specific debug messages

     -help                         print this help
     -help-<option>                print option-specific help

     -help-disk-images             about disk images
     -help-debug-tags              debug tags for -debug <tags>
     -help-char-devices            character <device> specification
     -help-environment             environment variables
     -help-virtual-device          virtual device management
     -help-sdk-images              about disk images when using the SDK
     -help-build-images            about disk images when building Android
     -help-all                     prints all help content


- stderr:
Exec mono --version
 stdout:
 stderr: /bin/sh: mono: command not found

Exec git --version
 stdout: git version 2.12.2

 stderr:
Exec gradle -v
 stdout:
------------------------------------------------------------
Gradle 2.10
------------------------------------------------------------

Build time:   2015-12-21 21:15:04 UTC
Build number: none
Revision:     276bdcded730f53aa8c11b479986aafa58e124a6

Groovy:       2.4.4
Ant:          Apache Ant(TM) version 1.9.3 compiled on December 23 2013
JVM:          1.8.0_131 (Oracle Corporation 25.131-b11)
OS:           Mac OS X 10.12.4 x86_64


 stderr:
Exec "/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/bin/javac" -version
 stdout:
 stderr: javac 1.8.0_131

System information:
{ procInfo: 'nativescript/3.0.0',
  platform: 'darwin',
  os: 'Darwin Henks-MacBook-Pro.local 16.5.0 Darwin Kernel Version 16.5.0: Fri Mar  3 16:52:33 PST 2017; root:xnu-3789.51.2~3/RELEASE_X86_64 x86_64\n',
  shell: '/usr/local/bin/zsh',
  dotNetVer: null,
  procArch: 'x64',
  nodeVer: 'v6.9.4',
  npmVer: '4.4.4',
  javaVer: '1.8.0',
  nodeGypVer: null,
  xcodeVer: 'Xcode 8.2.1\nBuild version 8C1002\n',
  xcodeprojGemLocation: '/usr/local/opt/rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/xcodeproj-1.4.4/lib/xcodeproj.rb\n',
  itunesInstalled: true,
  cocoapodVer: '1.2.0',
  adbVer: 'Android Debug Bridge version 1.0.39',
  emulatorInstalled: true,
  monoVer: null,
  gitVer: '2.12.2',
  gradleVer: '2.10',
  javacVersion: '1.8.0_131' }
Looking for project in '/Users/henk/Projects/Essent/ed-app-aot'
Project directory is '/Users/henk/Projects/Essent/ed-app-aot'.
Initializing analytics statuses.
Analytics statuses:
{ TrackFeatureUsage: 1, TrackExceptions: 1 }
Trying to track feature 'CLI' with value 'test|ios'.
Searching for devices...
startLookingForDevices; platform is ios
Starting to look for iOS devices.
Exec ps cax | grep launchd_sim
 stdout: 73135   ??  S      0:01.12 launchd_sim

 stderr:
Found device with identifier 'ABFD1BFD-2206-4467-AE24-ADCF6D951E5B'
startLookingForDevices; platform is iOS
Exec ps cax | grep launchd_sim
 stdout: 73135   ??  S      0:01.12 launchd_sim

 stderr:
{
    "browsers": [
        "ios"
    ],
    "configFile": "/Users/henk/Projects/Essent/ed-app-aot/karma.conf.js",
    "_NS": {
        "log": "TRACE",
        "tns": "/Users/henk/.nvm/versions/node/v6.9.4/bin/tns",
        "node": "/Users/henk/.nvm/versions/node/v6.9.4/bin/node",
        "options": {
            "debugTransport": false,
            "debugBrk": false,
            "watch": false
        }
    },
    "logLevel": "DEBUG",
    "singleRun": true,
    "projectDir": "/Users/henk/Projects/Essent/ed-app-aot"
}
fork: /Users/henk/.nvm/versions/node/v6.9.4/lib/node_modules/nativescript/lib/services/karma-execution.js undefined
05 05 2017 15:55:25.941:DEBUG [config]: Loading config /Users/henk/Projects/Essent/ed-app-aot/karma.conf.js
05 05 2017 15:55:25.953:DEBUG [config]: autoWatch set to false, because of singleRun
05 05 2017 15:55:25.955:DEBUG [plugin]: Loading karma-* from /Users/henk/Projects/Essent/ed-app-aot/node_modules
05 05 2017 15:55:25.956:DEBUG [plugin]: Loading plugin /Users/henk/Projects/Essent/ed-app-aot/node_modules/karma-chai.
05 05 2017 15:55:25.958:DEBUG [plugin]: Loading plugin /Users/henk/Projects/Essent/ed-app-aot/node_modules/karma-junit-reporter.
05 05 2017 15:55:26.000:DEBUG [plugin]: Loading plugin /Users/henk/Projects/Essent/ed-app-aot/node_modules/karma-mocha.
05 05 2017 15:55:26.005:DEBUG [plugin]: Loading plugin /Users/henk/Projects/Essent/ed-app-aot/node_modules/karma-nativescript-launcher.
05 05 2017 15:55:26.036:DEBUG [plugin]: Loading plugin /Users/henk/Projects/Essent/ed-app-aot/node_modules/karma-sinon.
05 05 2017 15:55:26.038:DEBUG [plugin]: Loading plugin /Users/henk/Projects/Essent/ed-app-aot/node_modules/karma-spec-reporter.
05 05 2017 15:55:26.060:DEBUG [plugin]: Loading inlined plugin (defining 0, 1).
05 05 2017 15:55:26.060:DEBUG [plugin]: Loading inlined plugin (defining launcher:android, launcher:ios, launcher:ios_simulator).
05 05 2017 15:55:26.075:DEBUG [web-server]: Instantiating middleware
05 05 2017 15:55:26.077:DEBUG [reporter]: Trying to load reporter: spec
05 05 2017 15:55:26.079:DEBUG [reporter]: Trying to load color-version of reporter: spec (spec_color)
05 05 2017 15:55:26.079:DEBUG [reporter]: Couldn't load color-version.
05 05 2017 15:55:26.079:DEBUG [reporter]: Trying to load reporter: junit
05 05 2017 15:55:26.080:DEBUG [reporter]: Trying to load color-version of reporter: junit (junit_color)
05 05 2017 15:55:26.081:DEBUG [reporter]: Couldn't load color-version.
05 05 2017 15:55:26.224:WARN [karma]: Port 9876 in use
05 05 2017 15:55:26.225:WARN [karma]: Port 9877 in use
05 05 2017 15:55:26.225:WARN [karma]: Port 9878 in use
05 05 2017 15:55:26.225:INFO [karma]: Karma v1.6.0 server started at http://0.0.0.0:9879/
05 05 2017 15:55:26.226:INFO [launcher]: Launching browser ios with unlimited concurrency
05 05 2017 15:55:26.239:INFO [launcher]: Starting browser NativeScript Unit Test Runner
## Unit-testing: Parent process received message { url:
   { protocol: 'http:',
     slashes: true,
     auth: null,
     host: 'localhost:9879',
     port: '9879',
     hostname: 'localhost',
     hash: null,
     search: null,
     query: null,
     pathname: '/',
     path: '/',
     href: 'http://localhost:9879/' },
  launcherConfig: '{"debugTransport":false,"debugBrk":false,"watch":false}' }
Storing credentials is not supported on darwin yet.
Using proxy: http://127.0.0.1:8888
User-Agent: tnsCLI/3.0.0 (Node.js 6.9.4; darwin; x64)
httpRequest: { url: 'http://localhost:9879/socket.io/socket.io.js',
  method: 'GET',
  proto: 'http',
  host: 'localhost',
  port: '9879',
  path: '/socket.io/socket.io.js',
  headers:
   { Accept: 'application/json; charset=UTF-8, */*;q=0.8',
     'User-Agent': 'tnsCLI/3.0.0 (Node.js 6.9.4; darwin; x64)',
     'Accept-Encoding': 'gzip,deflate' },
  proxy: 'http://127.0.0.1:8888',
  rejectUnauthorized: false,
  encoding: null,
  followAllRedirects: true }
httpRequest: Sending:
[no content]
httpRequest: Done. code = 503
Request was unsuccessful. Server returned:  <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html><head>
<meta type="copyright" content="Copyright (C) 1996-2016 The Squid Software Foundation and contributors">
<meta http-equiv="Content-Type" CONTENT="text/html; charset=utf-8">
<title>ERROR: The requested URL could not be retrieved</title>
<style type="text/css"><!--
 /*
 * Copyright (C) 1996-2016 The Squid Software Foundation and contributors
 *
 * Squid software is distributed under GPLv2+ license and includes
 * contributions from numerous individuals and organizations.
 * Please see the COPYING and CONTRIBUTORS files for details.
 */

/*
 Stylesheet for Squid Error pages
 Adapted from design by Free CSS Templates
 http://www.freecsstemplates.org
 Released for free under a Creative Commons Attribution 2.5 License
*/

/* Page basics */
* {
	font-family: verdana, sans-serif;
}

html body {
	margin: 0;
	padding: 0;
	background: #efefef;
	font-size: 12px;
	color: #1e1e1e;
}

/* Page displayed title area */
#titles {
	margin-left: 15px;
	padding: 10px;
	padding-left: 100px;
	background: url('/squid-internal-static/icons/SN.png') no-repeat left;
}

/* initial title */
#titles h1 {
	color: #000000;
}
#titles h2 {
	color: #000000;
}

/* special event: FTP success page titles */
#titles ftpsuccess {
	background-color:#00ff00;
	width:100%;
}

/* Page displayed body content area */
#content {
	padding: 10px;
	background: #ffffff;
}

/* General text */
p {
}

/* error brief description */
#error p {
}

/* some data which may have caused the problem */
#data {
}

/* the error message received from the system or other software */
#sysmsg {
}

pre {
    font-family:sans-serif;
}

/* special event: FTP / Gopher directory listing */
#dirmsg {
    font-family: courier;
    color: black;
    font-size: 10pt;
}
#dirlisting {
    margin-left: 2%;
    margin-right: 2%;
}
#dirlisting tr.entry td.icon,td.filename,td.size,td.date {
    border-bottom: groove;
}
#dirlisting td.size {
    width: 50px;
    text-align: right;
    padding-right: 5px;
}

/* horizontal lines */
hr {
	margin: 0;
}

/* page displayed footer area */
#footer {
	font-size: 9px;
	padding-left: 10px;
}


body
:lang(fa) { direction: rtl; font-size: 100%; font-family: Tahoma, Roya, sans-serif; float: right; }
:lang(he) { direction: rtl; }
 --></style>
</head><body id=ERR_CONNECT_FAIL>
<div id="titles">
<h1>ERROR</h1>
<h2>The requested URL could not be retrieved</h2>
</div>
<hr>

<div id="content">
<p>The following error was encountered while trying to retrieve the URL: <a href="http://localhost:9879/socket.io/socket.io.js">http://localhost:9879/socket.io/socket.io.js</a></p>

<blockquote id="error">
<p><b>Connection to ::1 failed.</b></p>
</blockquote>

<p id="sysmsg">The system returned: <i>(61) Connection refused</i></p>

<p>The remote host or network may be down. Please try the request again.</p>

<p>Your cache administrator is <a href="mailto:webmaster?subject=CacheErrorInfo%20-%20ERR_CONNECT_FAIL&amp;body=CacheHost%3A%20localhost%0D%0AErrPage%3A%20ERR_CONNECT_FAIL%0D%0AErr%3A%20(61)%20Connection%20refused%0D%0ATimeStamp%3A%20Fri,%2005%20May%202017%2013%3A55%3A26%20GMT%0D%0A%0D%0AClientIP%3A%20127.0.0.1%0D%0AServerIP%3A%20localhost%0D%0A%0D%0AHTTP%20Request%3A%0D%0AGET%20%2Fsocket.io%2Fsocket.io.js%20HTTP%2F1.1%0AAccept%3A%20application%2Fjson%3B%20charset%3DUTF-8,%20*%2F*%3Bq%3D0.8%0D%0AUser-Agent%3A%20tnsCLI%2F3.0.0%20(Node.js%206.9.4%3B%20darwin%3B%20x64)%0D%0AAccept-Encoding%3A%20gzip,deflate%0D%0AHost%3A%20localhost%3A9879%0D%0AConnection%3A%20close%0D%0A%0D%0A%0D%0A">webmaster</a>.</p>

<br>
</div>

<hr>
<div id="footer">
<p>Generated Fri, 05 May 2017 13:55:26 GMT by localhost (squid/3.5.15)</p>
<!-- ERR_CONNECT_FAIL -->
</div>
</body></html>

{ Error: The server returned unexpected response: SyntaxError: Unexpected token < in JSON at position 0
    at IncomingMessage.responseStream.on (/Users/henk/.nvm/versions/node/v6.9.4/lib/node_modules/nativescript/lib/common/http-client.js:134:43)
    at emitNone (events.js:91:20)
    at IncomingMessage.emit (events.js:185:7)
    at endReadableNT (_stream_readable.js:974:12)
    at _combinedTickCallback (internal/process/next_tick.js:74:11)
    at process._tickCallback (internal/process/next_tick.js:98:9)
  response:
   IncomingMessage {
     _readableState:
      ReadableState {
        objectMode: false,
        highWaterMark: 16384,
        buffer: [Object],
        length: 0,
        pipes: null,
        pipesCount: 0,
        flowing: true,
        ended: true,
        endEmitted: true,
        reading: false,
        sync: true,
        needReadable: false,
        emittedReadable: false,
        readableListening: false,
        resumeScheduled: false,
        defaultEncoding: 'utf8',
        ranOut: false,
        awaitDrain: 0,
        readingMore: false,
        decoder: null,
        encoding: null },
     readable: false,
     domain: null,
     _events:
      { end: [Object],
        close: [Object],
        data: [Object],
        error: [Function] },
     _eventsCount: 4,
     _maxListeners: undefined,
     socket:
      Socket {
        connecting: false,
        _hadError: false,
        _handle: null,
        _parent: null,
        _host: null,
        _readableState: [Object],
        readable: false,
        domain: null,
        _events: [Object],
        _eventsCount: 8,
        _maxListeners: undefined,
        _writableState: [Object],
        writable: false,
        allowHalfOpen: false,
        destroyed: true,
        _bytesDispatched: 240,
        _sockname: null,
        _pendingData: null,
        _pendingEncoding: '',
        server: null,
        _server: null,
        parser: null,
        _httpMessage: [Object],
        read: [Function],
        _consuming: true,
        _idleNext: null,
        _idlePrev: null,
        _idleTimeout: -1 },
     connection:
      Socket {
        connecting: false,
        _hadError: false,
        _handle: null,
        _parent: null,
        _host: null,
        _readableState: [Object],
        readable: false,
        domain: null,
        _events: [Object],
        _eventsCount: 8,
        _maxListeners: undefined,
        _writableState: [Object],
        writable: false,
        allowHalfOpen: false,
        destroyed: true,
        _bytesDispatched: 240,
        _sockname: null,
        _pendingData: null,
        _pendingEncoding: '',
        server: null,
        _server: null,
        parser: null,
        _httpMessage: [Object],
        read: [Function],
        _consuming: true,
        _idleNext: null,
        _idlePrev: null,
        _idleTimeout: -1 },
     httpVersionMajor: 1,
     httpVersionMinor: 1,
     httpVersion: '1.1',
     complete: true,
     headers:
      { server: 'squid/3.5.15',
        'mime-version': '1.0',
        date: 'Fri, 05 May 2017 13:55:26 GMT',
        'content-type': 'text/html;charset=utf-8',
        'content-length': '3766',
        'x-squid-error': 'ERR_CONNECT_FAIL 61',
        vary: 'Accept-Language',
        'content-language': 'en',
        'x-cache': 'MISS from localhost',
        via: '1.1 localhost (squid/3.5.15)',
        connection: 'close' },
     rawHeaders:
      [ 'Server',
        'squid/3.5.15',
        'Mime-Version',
        '1.0',
        'Date',
        'Fri, 05 May 2017 13:55:26 GMT',
        'Content-Type',
        'text/html;charset=utf-8',
        'Content-Length',
        '3766',
        'X-Squid-Error',
        'ERR_CONNECT_FAIL 61',
        'Vary',
        'Accept-Language',
        'Content-Language',
        'en',
        'X-Cache',
        'MISS from localhost',
        'Via',
        '1.1 localhost (squid/3.5.15)',
        'Connection',
        'close' ],
     trailers: {},
     rawTrailers: [],
     upgrade: false,
     url: '',
     method: null,
     statusCode: 503,
     statusMessage: 'Service Unavailable',
     client:
      Socket {
        connecting: false,
        _hadError: false,
        _handle: null,
        _parent: null,
        _host: null,
        _readableState: [Object],
        readable: false,
        domain: null,
        _events: [Object],
        _eventsCount: 8,
        _maxListeners: undefined,
        _writableState: [Object],
        writable: false,
        allowHalfOpen: false,
        destroyed: true,
        _bytesDispatched: 240,
        _sockname: null,
        _pendingData: null,
        _pendingEncoding: '',
        server: null,
        _server: null,
        parser: null,
        _httpMessage: [Object],
        read: [Function],
        _consuming: true,
        _idleNext: null,
        _idlePrev: null,
        _idleTimeout: -1 },
     _consuming: true,
     _dumped: false,
     req:
      ClientRequest {
        domain: null,
        _events: [Object],
        _eventsCount: 5,
        _maxListeners: undefined,
        output: [],
        outputEncodings: [],
        outputCallbacks: [],
        outputSize: 0,
        writable: true,
        _last: true,
        upgrading: false,
        chunkedEncoding: false,
        shouldKeepAlive: false,
        useChunkedEncodingByDefault: false,
        sendDate: false,
        _removedHeader: {},
        _contentLength: 0,
        _hasBody: true,
        _trailer: '',
        finished: true,
        _headerSent: true,
        socket: [Object],
        connection: [Object],
        _header: 'GET http://localhost:9879/socket.io/socket.io.js HTTP/1.1\r\nAccept: application/json; charset=UTF-8, */*;q=0.8\r\nUser-Agent: tnsCLI/3.0.0 (Node.js 6.9.4; darwin; x64)\r\nAccept-Encoding: gzip,deflate\r\nhost: localhost:9879\r\nConnection: close\r\n\r\n',
        _headers: [Object],
        _headerNames: [Object],
        _onPendingData: null,
        agent: [Object],
        socketPath: undefined,
        timeout: undefined,
        method: 'GET',
        path: 'http://localhost:9879/socket.io/socket.io.js',
        _ended: true,
        parser: null,
        res: [Circular] },
     request:
      Request {
        domain: null,
        _events: [Object],
        _eventsCount: 4,
        _maxListeners: undefined,
        method: 'GET',
        proto: 'http',
        host: '127.0.0.1',
        port: '8888',
        path: 'http://localhost:9879/socket.io/socket.io.js',
        headers: [Object],
        proxy: [Object],
        rejectUnauthorized: false,
        encoding: null,
        followAllRedirects: true,
        readable: true,
        writable: true,
        explicitMethod: true,
        _qs: [Object],
        _auth: [Object],
        _oauth: [Object],
        _multipart: [Object],
        _redirect: [Object],
        _tunnel: [Object],
        setHeader: [Function],
        hasHeader: [Function],
        getHeader: [Function],
        removeHeader: [Function],
        localAddress: undefined,
        pool: [Object],
        dests: [],
        __isRequestRequest: true,
        uri: [Object],
        tunnel: false,
        setHost: true,
        originalCookieHeader: undefined,
        _disableCookies: true,
        _jar: undefined,
        httpModule: [Object],
        agentClass: [Object],
        agent: [Object],
        _started: true,
        href: 'http://localhost:9879/socket.io/socket.io.js',
        req: [Object],
        ntick: true,
        response: [Circular],
        originalHost: 'localhost:9879',
        originalHostHeaderName: 'host',
        responseContent: [Circular],
        _destdata: true,
        _ended: true },
     toJSON: [Function: responseToJSON],
     caseless: Caseless { dict: [Object] },
     read: [Function] },
  body: '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">\n<html><head>\n<meta type="copyright" content="Copyright (C) 1996-2016 The Squid Software Foundation and contributors">\n<meta http-equiv="Content-Type" CONTENT="text/html; charset=utf-8">\n<title>ERROR: The requested URL could not be retrieved</title>\n<style type="text/css"><!-- \n /*\n * Copyright (C) 1996-2016 The Squid Software Foundation and contributors\n *\n * Squid software is distributed under GPLv2+ license and includes\n * contributions from numerous individuals and organizations.\n * Please see the COPYING and CONTRIBUTORS files for details.\n */\n\n/*\n Stylesheet for Squid Error pages\n Adapted from design by Free CSS Templates\n http://www.freecsstemplates.org\n Released for free under a Creative Commons Attribution 2.5 License\n*/\n\n/* Page basics */\n* {\n\tfont-family: verdana, sans-serif;\n}\n\nhtml body {\n\tmargin: 0;\n\tpadding: 0;\n\tbackground: #efefef;\n\tfont-size: 12px;\n\tcolor: #1e1e1e;\n}\n\n/* Page displayed title area */\n#titles {\n\tmargin-left: 15px;\n\tpadding: 10px;\n\tpadding-left: 100px;\n\tbackground: url(\'/squid-internal-static/icons/SN.png\') no-repeat left;\n}\n\n/* initial title */\n#titles h1 {\n\tcolor: #000000;\n}\n#titles h2 {\n\tcolor: #000000;\n}\n\n/* special event: FTP success page titles */\n#titles ftpsuccess {\n\tbackground-color:#00ff00;\n\twidth:100%;\n}\n\n/* Page displayed body content area */\n#content {\n\tpadding: 10px;\n\tbackground: #ffffff;\n}\n\n/* General text */\np {\n}\n\n/* error brief description */\n#error p {\n}\n\n/* some data which may have caused the problem */\n#data {\n}\n\n/* the error message received from the system or other software */\n#sysmsg {\n}\n\npre {\n    font-family:sans-serif;\n}\n\n/* special event: FTP / Gopher directory listing */\n#dirmsg {\n    font-family: courier;\n    color: black;\n    font-size: 10pt;\n}\n#dirlisting {\n    margin-left: 2%;\n    margin-right: 2%;\n}\n#dirlisting tr.entry td.icon,td.filename,td.size,td.date {\n    border-bottom: groove;\n}\n#dirlisting td.size {\n    width: 50px;\n    text-align: right;\n    padding-right: 5px;\n}\n\n/* horizontal lines */\nhr {\n\tmargin: 0;\n}\n\n/* page displayed footer area */\n#footer {\n\tfont-size: 9px;\n\tpadding-left: 10px;\n}\n\n\nbody\n:lang(fa) { direction: rtl; font-size: 100%; font-family: Tahoma, Roya, sans-serif; float: right; }\n:lang(he) { direction: rtl; }\n --></style>\n</head><body id=ERR_CONNECT_FAIL>\n<div id="titles">\n<h1>ERROR</h1>\n<h2>The requested URL could not be retrieved</h2>\n</div>\n<hr>\n\n<div id="content">\n<p>The following error was encountered while trying to retrieve the URL: <a href="http://localhost:9879/socket.io/socket.io.js">http://localhost:9879/socket.io/socket.io.js</a></p>\n\n<blockquote id="error">\n<p><b>Connection to ::1 failed.</b></p>\n</blockquote>\n\n<p id="sysmsg">The system returned: <i>(61) Connection refused</i></p>\n\n<p>The remote host or network may be down. Please try the request again.</p>\n\n<p>Your cache administrator is <a href="mailto:webmaster?subject=CacheErrorInfo%20-%20ERR_CONNECT_FAIL&amp;body=CacheHost%3A%20localhost%0D%0AErrPage%3A%20ERR_CONNECT_FAIL%0D%0AErr%3A%20(61)%20Connection%20refused%0D%0ATimeStamp%3A%20Fri,%2005%20May%202017%2013%3A55%3A26%20GMT%0D%0A%0D%0AClientIP%3A%20127.0.0.1%0D%0AServerIP%3A%20localhost%0D%0A%0D%0AHTTP%20Request%3A%0D%0AGET%20%2Fsocket.io%2Fsocket.io.js%20HTTP%2F1.1%0AAccept%3A%20application%2Fjson%3B%20charset%3DUTF-8,%20*%2F*%3Bq%3D0.8%0D%0AUser-Agent%3A%20tnsCLI%2F3.0.0%20(Node.js%206.9.4%3B%20darwin%3B%20x64)%0D%0AAccept-Encoding%3A%20gzip,deflate%0D%0AHost%3A%20localhost%3A9879%0D%0AConnection%3A%20close%0D%0A%0D%0A%0D%0A">webmaster</a>.</p>\n\n<br>\n</div>\n\n<hr>\n<div id="footer">\n<p>Generated Fri, 05 May 2017 13:55:26 GMT by localhost (squid/3.5.15)</p>\n<!-- ERR_CONNECT_FAIL -->\n</div>\n</body></html>\n' }
IOSDeviceOperations disposed.

So what I would like to see Is a way to bypass the proxy, like this:
screen shot 2017-05-05 at 16 08 37

I suggest to use the env NO_PROXY to exclude domain/hosts from the proxy/ A lot of cli tools use the NO_PROXY env to do this, see http://stackoverflow.com/questions/25989699/how-to-exclude-certain-domains-from-an-npm-proxy

@StevenLJackson1
Copy link

I'm running into this issue, as well, with {N} 3.3.0. I tried to run unit tests and couldn't until I did tns proxy clear.

Would it be possible to have localhost URLs bypass the proxy as a short-term fix?

martinfrancois added a commit to martinfrancois/nativescript-cli that referenced this issue Apr 24, 2019
Do not use the proxy for requests to localhost or 127.0.0.1 when NativeScript is configured to use the proxy.

Partially fixes issue NativeScript#2313, since requests to localhost will be possible in corporate proxy environments.
@ghost ghost added the new PR label Apr 24, 2019
@ghost ghost removed the new PR label Apr 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants
@spike1292 @valentinstoychev @StevenLJackson1 @dtopuzov @NiketanMhatre @pkoleva @NickIliev and others