★ wanayoo — archive 1999 https://github.com/ionic-team/ionic-cli/issues/3849Nouvelle recherche | Portail wanayoo
Skip to content
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

`ionic cordova resources` fails #3849

Open
sergey-drpa opened this Issue Jan 29, 2019 · 16 comments

Comments

Projects
None yet
9 participants
@sergey-drpa
Copy link

sergey-drpa commented Jan 29, 2019

Bug Report

Ionic version:
4.9.0

Current behavior:
When run ionic cordova resources
execution fails with:

HTTP Error 520: POST https://res.ionic.io/api/v1/upload

<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en-US"> <![endif]-->
<!--[if IE 7]>    <html class="no-js ie7 oldie" lang="en-US"> <![endif]-->
<!--[if IE 8]>    <html class="no-js ie8 oldie" lang="en-US"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en-US"> <!--<![endif]-->
<head>


<title>res.ionic.io | 520: Web server is returning an unknown error</title>
<meta charset="UTF-8" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" />
<meta name="robots" content="noindex, nofollow" />
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1" />
<link rel="stylesheet" id="cf_styles-css" href="/old?u=https%3A%2F%2Fgithub.com%2Fcdn-cgi%2Fstyles%2Fcf.errors.css&y=1999" type="text/css" media="screen,projection" />
<!--[if lt IE 9]><link rel="stylesheet" id='cf_styles-ie-css' href="/old?u=https%3A%2F%2Fgithub.com%2Fcdn-cgi%2Fstyles%2Fcf.errors.ie.css&y=1999" type="text/css" media="screen,projection" /><!
<style type="text/cs ...

or

      throw Error("end() has already been called, so it's too late to start piping");
      ^

Error: end() has already been called, so it's too late to start piping
    at Response.response.pipe (C:\Users\drapa\AppData\Roaming\npm\node_modules\ionic\node_modules\superagent\lib\node\index.js:859:13)
    at Request.req.type.send.on.res (C:\Users\drapa\AppData\Roaming\npm\node_modules\ionic\lib\integrations\cordova\resources.js:166:25)
    at Request.emit (events.js:182:13)
    at Request._emitResponse (C:\Users\drapa\AppData\Roaming\npm\node_modules\ionic\node_modules\superagent\lib\node\index.js:862:8)
    at ClientRequest.req.once.res (C:\Users\drapa\AppData\Roaming\npm\node_modules\ionic\node_modules\superagent\lib\node\index.js:412:10)
    at Object.onceWrapper (events.js:273:13)
    at ClientRequest.emit (events.js:187:15)
    at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:556:21)
    at HTTPParser.parserOnHeadersComplete (_http_common.js:109:17)
    at TLSSocket.socketOnData (_http_client.js:442:20)

Expected behavior:
Generate resources

Steps to reproduce:
Windows/MacOS run ionic cordova resources

Other information:
https://stackoverflow.com/questions/54155176/ionic-cordova-resources-splash-and-icon-error

Ionic info:

Ionic:

   ionic (Ionic CLI)             : 4.9.0 (C:\Users\drapa\AppData\Roaming\npm\node_modules\ionic)
   Ionic Framework               : @ionic/angular 4.0.0
   @angular-devkit/build-angular : 0.12.3
   @angular-devkit/schematics    : 7.2.3
   @angular/cli                  : 7.1.4
   @ionic/angular-toolkit        : 1.2.3

Cordova:

   cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)
   Cordova Platforms     : android 7.1.4
   Cordova Plugins       : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 2.3.2, (and 10 other plugins)

System:

   Android SDK Tools : 26.1.1 (C:\Android\sdk)
   NodeJS            : v10.14.2 (C:\Program Files\nodejs\node.exe)
   npm               : 6.4.1
   OS                : Windows 7
@rafalschmidt97

This comment has been minimized.

Copy link

rafalschmidt97 commented Jan 30, 2019 •

This is actually a funny one. I had the same yesterday. There is a workaround for that. Instead of running one command which will generate everything:

ionic cordova resources

try this:

ionic cordova resources ios
ionic cordova resources android
@Moussa-M

This comment has been minimized.

Copy link

Moussa-M commented Jan 30, 2019 •

Same error with me too

> ionic cordova resources android --force
√ Collecting resource configuration and source images - done!
√ Filtering out image resources that do not need regeneration - done!
(node:3960) ExperimentalWarning: The http2 module is an experimental API.
√ Uploading source images to prepare for transformations: 2 / 2 complete - done!
/ Generating platform resources
C:\Users\Slash\AppData\Roaming\npm\node_modules\ionic\node_modules\superagent\lib\node\index.js:859
      throw Error("end() has already been called, so it's too late to start piping");
      ^

Error: end() has already been called, so it's too late to start piping
    at Response.response.pipe (C:\Users\Slash\AppData\Roaming\npm\node_modules\ionic\node_modules\superagent\lib\node\index.js:859:13)
    at Request.req.type.send.on.res (C:\Users\Slash\AppData\Roaming\npm\node_modules\ionic\lib\integrations\cordova\resources.js:166:25)
    at Request.emit (events.js:160:13)
    at Request._emitResponse (C:\Users\Slash\AppData\Roaming\npm\node_modules\ionic\node_modules\superagent\lib\node\index.js:862:8)
    at ClientRequest.req.once.res (C:\Users\Slash\AppData\Roaming\npm\node_modules\ionic\node_modules\superagent\lib\node\index.js:412:10)
    at Object.onceWrapper (events.js:255:19)
    at ClientRequest.emit (events.js:165:20)
    at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:548:21)
    at HTTPParser.parserOnHeadersComplete (_http_common.js:115:23)
    at TLSSocket.socketOnData (_http_client.js:439:20)
@Moussa-M

This comment has been minimized.

Copy link

Moussa-M commented Jan 30, 2019

I've found the issue
I was missing icon.png in my resources folder

https://ionicframework.com/docs/cli/commands/cordova-resources/

@ndrake

This comment has been minimized.

Copy link

ndrake commented Jan 30, 2019

I see this too when generating for iOS. Possibly because my source icon.png is smaller than 1024x1024?

ionic:lib:integrations:cordova:resources response 400 received for icon-1024.png: (id: a609b411d96b5ae5ae9b5d57ace98104) +37ms
/Users/ndrake/.nvm/versions/node/v10.15.0/lib/node_modules/ionic/node_modules/superagent/lib/node/index.js:859

@brandyscarney brandyscarney transferred this issue from ionic-team/ionic Feb 5, 2019

@ionitron-bot ionitron-bot bot added the triage label Feb 5, 2019

@etpl7

This comment has been minimized.

Copy link

etpl7 commented Feb 19, 2019

I had the same problem. Make sure that you have icon (1024 x 1024) and splash (2732 x 2732) in resources folder.

@arcreative

This comment was marked as disruptive content.

Copy link

arcreative commented Mar 11, 2019 •

@etpl7 Well of course that would be the issue. I'm so fed up with this entire platform. What could possibly be wrong with throwing such a cryptic, idiotic error when processing a file that's been fine literally for years now?

@dwieeb

This comment has been minimized.

Copy link
Contributor

dwieeb commented Mar 11, 2019 •

Just a little update. We're aware ionic cordova resources is not ideal. We won't be providing any updates to the existing system. It was built a long time ago and only recently we've found time to rethink it.

Take a look at my comment for using the local resource generation tool we've been working on. Here's the repo for it: https://github.com/ionic-team/cordova-res

We welcome any constructive feedback for the new flow. cordova-res will likely be made the default in Ionic CLI 5 (it's a breaking change because it only allows PNGs for source images).

@LucasMW

This comment has been minimized.

Copy link

LucasMW commented Mar 14, 2019

This is actually a funny one. I had the same yesterday. There is a workaround for that. Instead of running one command which will generate everything:

ionic cordova resources

try this:

ionic cordova resources ios
ionic cordova resources android

Wow, it works.
That was unexpected.

@arcreative

This comment has been minimized.

Copy link

arcreative commented Mar 14, 2019

@dwieeb No one’s even going to fix the error message? I understand not fixing the whole chain, but it seems a little off to not fix something like this IMO. Sorry you thought my earlier comment was “disruptive”, but issues like this are the reason I’m moving farther and farther away from ionic as time goes on. My frustration stems from the fact that my project can’t age even 1-2 months without me having to start completely over on some crazy line of detective work when all I want to do is publish a trivial update to my app. Thus far, I’ve dropped the standard build process in favor of my own Gulpfile, resources pipeline, new platform updates, and essentially all the other commands in favor of vanilla Cordova and Gulp. Sorry my comment wasn’t tactful, but there are some really prevalent quality of life issues with Ionic.

@arcreative

This comment has been minimized.

Copy link

arcreative commented Mar 14, 2019

@LucasMW this didn’t work for me, but resizing splash.png to 2732 did. I was frustrated because the size I had was the old recommended standard, which seems to have been increased for iPad Pro.

@dwieeb

This comment has been minimized.

Copy link
Contributor

dwieeb commented Mar 14, 2019

@arcreative We've already poured so much development time into the resources service. Generating Cordova resources is not a core strength of Ionic. It is better for us to focus on the framework and supporting tools, not an image resizing service. Additionally, since this legacy resources service performs the CPU-intensive image scaling (and network transfer) on our servers and since the service is completely free, we lose quite a bit of money to it each year.

There are many offline/local options available for resizing Cordova resources. Ionic even has one now: cordova-res. I started the project in an attempt to deprecate the legacy resources service as soon as possible. You can try it today:

npm i -g cordova-res
ionic cordova resources --cordova-res

I apologize to those who've run into obscure errors with this command. We've tried to mitigate the issues with good documentation, but we know it's not enough. The sooner we get rid of the legacy service and make cordova-res the default, the better.

@arcreative

This comment has been minimized.

Copy link

arcreative commented Mar 15, 2019

@dwieeb I can totally understand your position on this, but it seems like this problem could still be easily addressed either a) on the resource server, or b) in the error handling of the module hitting the resource server. If the resource server can properly handle a large image but not a smaller one, this has to be a simple issue to fix. Regardless of what your plans are for resource generation in the future, this is currently the accepted standard, and just refusing to fix it doesn't seem like a reasonable stance to have for a service/platform that thousands of people rely on.

@dwieeb

This comment has been minimized.

Copy link
Contributor

dwieeb commented Mar 15, 2019 •

It's not easily addressed. It is a legacy system that is quite brittle. The CLI code is fairly complex, and in the past when I've improved it I've broken it in some way. Any attempt to fix, test, improve, etc. will be a serious time sink that we're not willing to make. Reference:

Besides, we are stretched thin on much higher priority things. The resources command has behaved this way for many months and this issue only has 8 participants. It's just not our focus.

We of course welcome pull requests to improve the developer experience for everyone, but with the upcoming switch to cordova-res (likely a change we'll make for CLI v5 when Node 6 gets phased out).

@arcreative

This comment has been minimized.

Copy link

arcreative commented Mar 16, 2019 •

But the service side? I don’t think you have any/many CLI issues to fix if the service does its job. I would be willing to take a look, but guessing that’s not going to be an option.

@dwieeb

This comment has been minimized.

Copy link
Contributor

dwieeb commented Mar 18, 2019

Any change to the server side would require change(s) to the client side, even for error handling. The server code is even scarier, actually.

@DorianLovera

This comment has been minimized.

Copy link

DorianLovera commented Mar 24, 2019

For me the issue was that the resources (.png) were not at the right size

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.