CORS issue connecting to Ionic Deploy - ionic-framework

I have setup Ionic Deploy and am receiving the following error that is preventing android from pulling updates
Access to fetch at 'https://api.ionicjs.com/apps/--app-id=REMOVED%20/channels/check-device' from origin 'http://localhost' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: It does not have HTTP ok status.
Ionic Info
Ionic:
Ionic CLI : 5.2.1 )
Ionic Framework : #ionic/angular 4.9.0
#angular-devkit/build-angular : 0.803.3
#angular-devkit/schematics : 8.3.3
#angular/cli : 8.3.3
#ionic/angular-toolkit : 2.0.0
Cordova:
Cordova CLI : 9.0.0 (cordova-lib#9.0.1)
Cordova Platforms : android 8.0.0
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 3.1.2, (and 11 other plugins)
Any ideas?

At server side where you have your API api.ionicjs.com deployed, you need to enable CORs header components:
Access-Control-Allow-Origin
Access-Control-Allow-Methods
Access-Control-Allow-Headers
I am not sure about your server side tech stack, so can't suggest where to add this config changes, but sure little googling will find you step by step setup.

this is a server side issue so you have to resolve it from your server end, if you don't know how to enable CORS on your server then you must read this.
https://enable-cors.org/
there are some guidelines about to enable cors for every kind of servers. so no matter what server you are using, you have in it.

Related

Ionic 4 app shows api data in browser but on device it doen't shows api data

When I run Ionic 4 app, the browser shows api data but when i run same app on android device it doen't shows api data.
I am using Laravel as a backend, from where i am fetching api data.
The Ionic info is -
Ionic:
Ionic CLI : 6.5.0 (C:\Users\LENOVO\AppData\Roaming\npm\node_modules\#ionic\cli)
Ionic Framework : #ionic/angular 4.1.1
#angular-devkit/build-angular : 0.803.26
#angular-devkit/schematics : 8.3.26
#angular/cli : 8.3.26
#ionic/angular-toolkit : 2.2.0
Cordova:
Cordova CLI : not installed
Cordova Platforms : android 7.1.4
Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.1.3, (and 4 other plugins)
Utility:
cordova-res : not installed
native-run : 1.0.0
System:
NodeJS : v12.16.1 (C:\Program Files (x86)\nodejs\node.exe)
npm : 6.13.4
OS : Windows 10
I am really stuck here...
Your Problem is Cors you can install middleware in laravel to avoide the problem
Or you can test your application in the chrome disable securite
Try to Run :
chrome.exe --user-data-dir="C://Chrome dev session" --disable-web-security
and test your application in this chrome and let me khnow

Ionic App not running on ios/Android but working on browser

I developed an app that was working perfectly on Ionic DevApp on my iPhone. Suddenly it stopped working. I even tested a new blank app and it does not work. I tested on many wifi and 3G signals and also on an Android phone but it does not work!
On my iPhone I’m getting the following error:
Unable to load page. The request timed out.
On the Android phone I got this error:
error err_connection_timed_out.
I tried running the following, but none worked:
ionic serve
ionic serve -c
ionic serve -c --no-proxy
Running ionic info gives me:
Ionic:
ionic (Ionic CLI) : 4.5.0 (C:\Users\rodri\AppData\Roaming\npm\node_modules\ionic)
Ionic Framework : ionic-angular 3.9.2
#ionic/app-scripts : 3.2.0
Cordova:
cordova (Cordova CLI) : 8.1.2 (cordova-lib#8.1.1)
Cordova Platforms : android 7.1.2, ios 4.5.5
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 2.2.3, (and 5 other plugins)
System:
NodeJS : v10.13.0 (C:\Program Files\nodejs\node.exe)
npm : 6.4.1
OS : Windows 10
EDIT:
I tried running ionic repair which gives me this error:
shell.js: internal error
Error: ETIMEDOUT: connection timed out, read
[ERROR] An error occurred while running subprocess cordova.
cordova prepare exited with exit code 1.
It was just a Firewall coming from McAfee Firewall blocking the port I needed. Just had to open the port on the McAfee app.

Ionic googleplus plugin: Refused to display in a frame because it set 'X-Frame-Options' to 'sameorigin'

I am facing this issue when running in browser mode. How can I solve this? Would be possible to open this dialog in a new tab instead of an iFrame?
https://github.com/EddyVerbruggen/cordova-plugin-googleplus
Many thanks for the help!
Using Ionic with following settings:
cordova-plugin-googleplus 5.3.2 "Google SignIn"
Ionic:
ionic (Ionic CLI) : 4.0.5 (/usr/local/lib/node_modules/ionic)
Ionic Framework : ionic-angular 3.9.2
#ionic/app-scripts : 3.2.0
Cordova:
cordova (Cordova CLI) : 8.0.0
Cordova Platforms : android 7.0.0, browser 5.0.4, ios 4.5.5
System:
NodeJS : v8.11.3 (/usr/local/bin/node)
npm : 5.6.0
OS : macOS High Sierra
Xcode : Xcode 10.0 Build version 10A255
Try removing the cordova-plugin-inappbrowser plugin.
Coexist with inAppBrowser plugin (fixed)
Some plugins can only be tested/working inside a device.
I remember that the google+ sign need to use the google play services and the apk signature those things aren't available running in local browser with chrome.
It's likely you test the android push notifications with the chrome it won't work.
For these type of things better if you call the ionic with the live reload to test in the device and reload when you make changes
ionic cordova run android -l -c

Ionic Pro - ionic link fails

I have a paid subscription to Ionic Pro.
Running ionic link fails with the following error:
[ERROR] API request was successful, but the response format was
unrecognized.
Request: GET https://api.ionicjs.com/apps/<<app_id>>
Response: 200
Body: ........
Backend is set to pro.
I did try with legacy as well but that failed.
I tried logging out and back in, in both legacy and pro.
I also tried updating ionic, and clearing the node modules.
Environment Details:
ionic (Ionic CLI) : 4.0.6 (/usr/local/lib/node_modules/ionic)
Ionic Framework : ionic-angular 3.9.2
#ionic/app-scripts : 3.1.6

Getting "Sorry! The configured backend (pro) does not know about ionic upload" When trying to upload the Ionic App

I'm trying to upload the App I built to my Ionic Pro account.
I've linked my account and added the SSH keys but after running ionic upload I'm getting this error
[ERROR] Sorry! The configured backend (pro) does not know about ionic upload.
This is My Ionic Info
cli packages: (/home/jos/Desktop/helloapp/node_modules)
#ionic/cli-utils : 1.9.2
ionic (Ionic CLI) : 3.9.2
global packages:
Cordova CLI : 7.0.1
Gulp CLI : not installed globally
local packages:
Cordova Platforms : android 6.2.3 browser 4.1.0
Ionic Framework : ionic1 1.3.1
System:
Android SDK Tools : 26.0.2
Node : v6.11.0
npm : 3.10.10
OS : Linux 3.13
ionic upload doesn't work with backend pro, you have to create an app
on https://dashboard.ionicjs.com/apps and there will be a setup guide :)