ionic-cli icon indicating copy to clipboard operation
ionic-cli copied to clipboard

"ionic upload" and "ionic resources" don't use proxy

Open jonmikelm opened this issue 11 years ago • 39 comments

We have noticed that when we run "ionic upload" and "ionic resources" the proxy settings are ignored and the underlying https requests are made without proxy. In a usual enterprise network, this problem makes impossible to use this commands because of the security policies.

All the other commands like e.g. "ionic start" work perfectly and the download runs through the proxy with no problem. I neither have any problem with any other npm module that needs data to be downloaded from the internet.

It seems that the uploads made by ionic-cli don't use the proxy.

My system info:

OS: Windows XP Node Version: v0.10.34 Cordova CLI: 4.2.0 Ionic CLI Version: 1.3.13

jonmikelm avatar Mar 10 '15 07:03 jonmikelm

The problem persists after updating to Ionic CLI 1.3.14

jonmikelm avatar Mar 10 '15 10:03 jonmikelm

facing same issue. please let me know incase there is a solution

rajeshpks avatar Mar 18 '15 10:03 rajeshpks

Looking at the ionic-cli code, it seems that the problem is produced by the npm module used to send the data to the ionic servers:

https://github.com/felixge/node-form-data

In a first look, this module doesn't have a way to configure the proxy. This library could be overriding the global proxy configuration due to the way they are doing the submit.

Not sure if another issue should be opened in their repository.

jonmikelm avatar Mar 18 '15 11:03 jonmikelm

I'm having the same issue. Need to know how to add proxy settings to ionic configuration so that I can use the ionic cli upload command at work.

ewagnerdesign avatar Mar 19 '15 13:03 ewagnerdesign

The problem persists after updating to Ionic CLI 1.3.17

jonmikelm avatar Mar 25 '15 10:03 jonmikelm

Yes have the same issue, do we have a solution to this?

cyrilvarghese avatar Apr 22 '15 15:04 cyrilvarghese

same problem here ... any fix?

kcferguson1 avatar Apr 29 '15 14:04 kcferguson1

same issue here...

weiweiw3 avatar May 05 '15 06:05 weiweiw3

Sorry for the late response! I'll be patching the upload command to make it work behind proxies.

I'll post when I'm done!

jbavari avatar May 15 '15 19:05 jbavari

I don't currently have a proxy set up.

However, I've pushed a beta version.

Would some of you with proxies test it out to ensure that it works?

Ionic-CLI 1.4.4-beta.0 - npm install -g ionic@beta

jbavari avatar May 15 '15 19:05 jbavari

I've just tested the beta you pointed and the error keeps happening. Is there any log file that I can send you with more info?

C:\ionic\test>ionic resources Ionic icon and splash screen resources generator V icon android drawable-ldpi-icon.png (36x36) from cache V icon android drawable-mdpi-icon.png (48x48) from cache V icon android drawable-hdpi-icon.png (72x72) from cache V icon android drawable-xhdpi-icon.png (96x96) from cache V icon android drawable-xxhdpi-icon.png (144x144) from cache V icon android drawable-xxxhdpi-icon.png (192x192) from cache V icon ios icon.png (57x57) from cache V icon ios [email protected] (114x114) from cache V icon ios icon-40.png (40x40) from cache V icon ios [email protected] (80x80) from cache V icon ios icon-50.png (50x50) from cache V icon ios [email protected] (100x100) from cache V icon ios icon-60.png (60x60) from cache V icon ios [email protected] (120x120) from cache V icon ios [email protected] (180x180) from cache V icon ios icon-72.png (72x72) from cache V icon ios [email protected] (144x144) from cache V icon ios icon-76.png (76x76) from cache V icon ios [email protected] (152x152) from cache V icon ios icon-small.png (29x29) from cache V icon ios [email protected] (58x58) from cache V icon ios [email protected] (87x87) from cache V splash android drawable-port-mdpi-screen.png (320x480) from cache V splash android drawable-port-hdpi-screen.png (480x800) from cache V splash android drawable-port-xhdpi-screen.png (720x1280) from cache V splash android drawable-port-xxhdpi-screen.png (960x1600) from cache V splash android drawable-port-xxxhdpi-screen.png (1280x1920) from cache V splash ios Default-568h@2x~iphone.png (640x1136) from cache V splash ios Default-667h.png (750x1334) from cache V splash ios Default-736h.png (1242x2208) from cache V splash ios Default-Portrait@2x~ipad.png (1536x2048) from cache V splash ios Default-Portrait~ipad.png (768x1024) from cache V splash ios Default@2x~iphone.png (640x960) from cache V splash ios Default~iphone.png (320x480) from cache uploading splash.psd... ? Failed to upload source image: Error: connect ETIMEDOUT

C:\ionic\test>ionic info

Your system information:

Cordova CLI: 4.3.0 Gulp version: CLI version 3.8.9 Gulp local: Local version 3.8.11 Ionic Version: 1.0.0 Ionic CLI Version: 1.4.4-beta.0 Ionic App Lib Version: 0.0.19 OS: Windows XP Node Version: v0.10.34

jonmikelm avatar May 18 '15 07:05 jonmikelm

It looks like your splash image is timing out. What is the file size of that image?

Just a guess here - perhaps its too large and the server is timing out?

As far as a log - let me check with the back end team to see if they have logs on it.

jbavari avatar May 18 '15 15:05 jbavari

First of all, thanks for the work you do.

I don't think it's a timeout issue due to the file size. The splash.psd file i'ts a bit less than 1.5mb.

I think it's a proxy issue. Some weeks ago, when I opened this issue, our network admin changed the firewall to bypass the proxy for the ionic resources upload requests. After that, we noticed that the url used by the ionic cli to upload the resources changes randomly.

Since then, the upload resources command works somentimes, in fact, it works when the "ionic resources" (or "ionic upload" command) uses the url we first detected and configured in the proxy, that's to say, 1 out of 10-15 times more or less.

As an example, it has worked just a minute ago after 5 tries. (result below)

I think there is a problem with the npm module the ionic-cli uses to upload the files, https://github.com/felixge/node-form-data

C:\ionic\test>ionic resources Ionic icon and splash screen resources generator V icon android drawable-ldpi-icon.png (36x36) from cache V icon android drawable-mdpi-icon.png (48x48) from cache V icon android drawable-hdpi-icon.png (72x72) from cache V icon android drawable-xhdpi-icon.png (96x96) from cache V icon android drawable-xxhdpi-icon.png (144x144) from cache V icon android drawable-xxxhdpi-icon.png (192x192) from cache V icon ios icon.png (57x57) from cache V icon ios [email protected] (114x114) from cache V icon ios icon-40.png (40x40) from cache V icon ios [email protected] (80x80) from cache V icon ios icon-50.png (50x50) from cache V icon ios [email protected] (100x100) from cache V icon ios icon-60.png (60x60) from cache V icon ios [email protected] (120x120) from cache V icon ios [email protected] (180x180) from cache V icon ios icon-72.png (72x72) from cache V icon ios [email protected] (144x144) from cache V icon ios icon-76.png (76x76) from cache V icon ios [email protected] (152x152) from cache V icon ios icon-small.png (29x29) from cache V icon ios [email protected] (58x58) from cache V icon ios [email protected] (87x87) from cache uploading splash.psd... V splash.psd (2208x2208) upload complete generating splash ios Default~iphone.png (320x480)... generating splash ios Default@2x~iphone.png (640x960)... generating splash ios Default-Portrait~ipad.png (768x1024)... V splash ios Default~iphone.png (320x480) generated generating splash ios Default-Portrait@2x~ipad.png (1536x2048)... V splash ios Default@2x~iphone.png (640x960) generated generating splash ios Default-736h.png (1242x2208)... V splash ios Default-Portrait~ipad.png (768x1024) generated generating splash ios Default-667h.png (750x1334)... V splash ios Default-736h.png (1242x2208) generated generating splash ios Default-568h@2x~iphone.png (640x1136)... V splash ios Default-Portrait@2x~ipad.png (1536x2048) generated generating splash android drawable-port-xxxhdpi-screen.png (1280x1920)... V splash ios Default-667h.png (750x1334) generated generating splash android drawable-port-xxhdpi-screen.png (960x1600)... V splash ios Default-568h@2x~iphone.png (640x1136) generated generating splash android drawable-port-xhdpi-screen.png (720x1280)... V splash android drawable-port-xxhdpi-screen.png (960x1600) generated generating splash android drawable-port-hdpi-screen.png (480x800)... V splash android drawable-port-xxxhdpi-screen.png (1280x1920) generated V splash android drawable-port-mdpi-screen.png (320x480) generated generating splash android drawable-port-ldpi-screen.png (240x320)... V splash android drawable-port-xhdpi-screen.png (720x1280) generated V splash android drawable-port-ldpi-screen.png (240x320) generated V splash android drawable-port-hdpi-screen.png (480x800) generated

jonmikelm avatar May 18 '15 16:05 jonmikelm

Hello . Is the new version of upload.js that fixes the problem of using ionic upload behind proxy has been integrated(https://github.com/driftyco/ionic-cli/blob/master/lib/ionic/upload.js?MobileOptOut=1) ?

Because i still have the problem on the latest release : Ionic cli version : 1.4.6 Ionic app lib version : 0.0.22

I got "Error connect : ETIMEDOUT"

thank you very much

ulquio avatar May 28 '15 11:05 ulquio

@jbavari , any update on this issue ? any workaround to this ...it is impossible to upload project built in enterprise environment.

satya1395 avatar Jun 10 '15 10:06 satya1395

Workaround: Open 'npm_folder\node_modules\ionic\lib\ionic\resources\generate.js' and replace all 'process.env.PROXY' with your proxy settings like 'http://myproxy:myport'. Worked for me ;-)

ghost avatar Jun 12 '15 07:06 ghost

@RobertLibe , i am not getting ionic folder inside node_modules directory in my project.. I am using ionic version 1.0.0 (uranium-unicorn)

satya1395 avatar Jun 12 '15 09:06 satya1395

You have to change it globally: So the folder on Windows is mostly

C:\Users\USER\AppData\Roaming\npm\node_modules\ionic\lib\ionic\resources

ghost avatar Jun 12 '15 10:06 ghost

set PROXY=http://LOGIN:USER@URL:PORT
ionic resources android --icon --force

Work fine, this issue must be close Ami44

AlbanMinassian avatar Jun 24 '15 07:06 AlbanMinassian

Worked in my Mac as: $ PROXY=http://LOGIN:USER@URL:PORT ionic start myApp sidemenu

leocaseiro avatar Jul 08 '15 02:07 leocaseiro