ionic-cli: `ionic cordova resources` fails
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="/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 (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
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 21 (6 by maintainers)
I had the same problem. Make sure that you have icon (1024 x 1024) and splash (2732 x 2732) in resources folder.
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
Same error with me too
@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: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.I’ve found the issue I was missing icon.png in my resources folder
https://ionicframework.com/docs/cli/commands/cordova-resources/
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:
try this: