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="/cdn-cgi/styles/cf.errors.css" type="text/css" media="screen,projection" />
<!--[if lt IE 9]><link rel="stylesheet" id='cf_styles-ie-css' href="/cdn-cgi/styles/cf.errors.ie.css" 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 ([email protected])
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
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
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)
I've found the issue
I was missing icon.png in my resources folder
https://ionicframework.com/docs/cli/commands/cordova-resources/
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
I had the same problem. Make sure that you have icon (1024 x 1024) and splash (2732 x 2732) in resources folder.
@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?
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).
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 resourcestry this:
ionic cordova resources ios ionic cordova resources android
Wow, it works.
That was unexpected.
@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.
@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.
@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.
@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.
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).
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.
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.
For me the issue was that the resources (.png) were not at the right size
It failed for iOS unless the splash icon size was over 2732... using
ionic cordova resources --cordova-res
I had the same problem. Make sure that you have icon (1024 x 1024) and splash (2732 x 2732) in resources folder.
This worked for me and was different from the "required" sizes listed in the documentation... :(
@jasonnmark What documentation are you looking at? The online docs for the command are here: https://ionicframework.com/docs/cli/commands/cordova-resources
Thanks⦠Iāll see if I can find the other ones⦠somewhere it said icon needed to be 192???
Entrepreneur. Branding & Marketing. Business Leader. Efficiency Geek.
āWhatever your problem, there is always an easy solution waiting to be found. Our job is to find it.ā
On May 14, 2019, at 7:31 PM, dwieeb notifications@github.com wrote:
@jasonnmark https://github.com/jasonnmark What documentation are you looking at? The online docs for the command are here: https://ionicframework.com/docs/cli/commands/cordova-resources https://ionicframework.com/docs/cli/commands/cordova-resources
ā
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/ionic-team/ionic-cli/issues/3849?email_source=notifications&email_token=AATCOKAIKV57XOFOBJUHHTDPVNDVVA5CNFSM4GURB34KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODVNCSBI#issuecomment-492448005, or mute the thread https://github.com/notifications/unsubscribe-auth/AATCOKEUF6KTMJAFAIZ5FK3PVNDVVANCNFSM4GURB34A.
Ionic CLI 5 ships with support for generating Cordova resources locally using the cordova-res utility, which completely replaces the existing code for generating resources remotely in ionic cordova resources.
Give it a try! Leave feedback/bug reports in either repo. Thanks!
Most helpful comment
I had the same problem. Make sure that you have icon (1024 x 1024) and splash (2732 x 2732) in resources folder.