Unhandled rejection Error: Invalid URI "/"

Hi guys
I used api woocommerce - SignUp
1- case 1:
this.WooCommerce.postAsync(‘customers’, customerData, ).then((data) => {}
->> ERROR:
OPTIONS: 401 (Unauthorized)
Failed to load : Response for preflight has invalid HTTP status code 401

THEN I FIXED:
2-
let headers = new Headers();
headers.append(“Access-Control-Allow-Origin”, “*”);
headers.append(“Access-Control-Allow-Methods”, “PUT, POST, GET, OPTIONS, DELETE”);
headers.append(“Access-Control-Max-Age”, “3600”);
headers.append(“Authorization”, “Basic YWxhZGRpbjpvcGVuc2VzYW1l”);
headers.append(“Content-Type”,“application/json”);
let options = new RequestOptions({headers: headers});

this.WooCommerce.postAsync('customers', customerData, {headers: options}).then((data) => {}

ERROR:
Unhandled rejection Error: Invalid URI “/”

Anyone can help me?

i have de same problem! Are you fixed?

You can get through this very easy! Let’s follow me right now

  1. Create a shortcut on your desktop
  2. Right-click on the shortcut and click Properties
  3. Edit the Target property
  4. Set it to “C:\Program Files (x86)\Google\Chrome\Application\chrome.exe” --disable-web-security --user-data-dir=“C:/ChromeDevSession”
  5. In VIsual Studio Code, run ionic serve -l
  6. You’re gonna see new tab open http://localhost:8100/ionic-lab. You should be aware that this link is opened in the normal chrome tab, not the “disable-web-security” chrome we have set up.
  7. Double click to the shortcut that we have set up to open the “disable-web-security” chrome tab. Then paste http://localhost:8100/ionic-lab into this tab.

So the reason that we get multiple errors when working with woo-commerce-api is this “web-security” by Google. Then you just disable it and you actually don’t need any CORS Extensions. So remove them right now if you have installed.

And this solution i write for people who learn this course https://www.udemy.com/ionic-3-apps-for-woocommerce-build-an-ecommerce-mobile-app/. This is an ionic e-commerce app that using woo-commerce-api to set and get data from Wordpress (local or live server). If you have trouble in other language not ionic, it still works fine.

Actually i have done a lot of searchings on Google to find this solution. I hope this helps all of you. Now, i need to go to bed because tomorrow i have a final report about this ionic project with my lecturer :smiley:

See ya!
Quy Le