migueesc123 / WooCommerceConnector

A Power BI Custom Connector for WooCommerce
MIT License
30 stars 12 forks source link

Error in connection #1

Closed marcosqlbi closed 7 years ago

marcosqlbi commented 7 years ago

I always get this error when I'm try to connect. What should I do to investigate more?

Details: "The field 'X-WP-TotalPages' of the record wasn't found."

migueesc123 commented 7 years ago

Marco! :(

Could you please check the WooCommerce version that you're using? Depending on the WooCommerce version that you have installed we'd have to use a different endpoint: image

Let me know what version of WooCommerce you're using.

Thanks for trying out the connector!

migueesc123 commented 7 years ago

Just uploaded a new .mez file. Hopefully you're using WooCommerce 2.6.x as I've just tested this with a site that is using it and it works perfectly.

marcosqlbi commented 7 years ago

I have v 2.6.14 - just tried and I have the same error. I suspect there is something I should do on our side? Or maybe that the URL should be different because of the particular configuration we might have?

migueesc123 commented 7 years ago

ok, you're on wordpress 4.8 (according to this https://www.sqlbi.com/wp-login.php), you're using WC v2.6.14 and you entered the link to your site in the .mez file. The only thing that I could think of is either that the API is not enabled yet and you need to enable it on your WooCommerce: image or the credentials entered are incorrect

Can you confirm that the API is enabled for your WooCommerce?

marcosqlbi commented 7 years ago

Yes, it's enabled and the credentials are correct. I will be out of office a few days, I'll investigate more when I'll be back.

migueesc123 commented 7 years ago

You'd need to get Fiddler and check out the response that you're getting from your server.

Here's an example from me trying to access your site and getting denied: image

You should get a 200 response, but an error might give you a 300 response. Let me know what you get when you have time.

migueesc123 commented 7 years ago

Hey Marco!

I just published a new version of the connector. All you need to do is download the new .mez file and that's it. No need to edit the file at all. I even went ahead and set up a testing environment so you can try and use the connector against some dummy data.

Let me know if this new version works for you.

FrankFromGermany commented 7 years ago

Miguel, using your .mez file and the data provided I have the same problem as Marco. "The field 'X-WP-TotalPages' of the record wasn't found." status=401 message=Sorry, you cannot list resources.

migueesc123 commented 7 years ago

Hey Frank!

You might be getting that error if you're using the url as http instead of https. Can you confirm that you're using https?

I can def repro if the url is in http, but can't repro if the url is in https.

FrankFromGermany commented 7 years ago

@Miguel, you are right! One has to use https. I guess you should adjust your instructions accordingly.

"Here's the data of our testing environment: •Url for the Store = http://woocommerceconnector.azurewebsites.net •API Version = v2 •API_username: ck_00c9112a8aee53ed8ea2484922630372003f96bc •API_password: cs_e51db59027ec9f985c22e86e802eba3fdd51c9f6"

migueesc123 commented 7 years ago

just checked. You are right about that. I used the http on the readme file of this repo. Just changed it to the https.

Thanks for it!

migueesc123 commented 7 years ago

@FrankFromGermany don't forget to place a few orders on the site just for testing! :) you can even leave some notes on the order

marcosqlbi commented 7 years ago

I have a good news: it works on our production site, too! The bad news is that it could be very heavy... we implemented a more sophisticated incremental export that allow us to run several refreshes over a day without impacting the web site performance. I measured the impact of an export, and if you have a certain volume of data the workload could impact the performance of the web site. However, it's very useful! You can navigate in all the information of the orders!

One suggestion: in the documentation you should clarify that username and password correspond to API Keys that you have to generate in order to enable the access (maybe I missed this step a few days ago!!).

Great job!

migueesc123 commented 7 years ago

nice, Marco! And yeah, absolutely something to take in consideration. I'm trying to compare the impact of going through the API vs doing native queries against the wordpress MySQL database, but hosting the testing environment on azure hasn't been so great so far =/

migueesc123 commented 7 years ago

oh btw, as a comment, custom connectors will become available under the TOM, so you can imagine that one day you'll be able to automatically create partitions with a custom connector like this one so you don't have to rely on the exports :) - the WooCommerce API already has some parameters so you can do the partitions quite easily.

Getting the full data every single time you refresh could be quite expensive, so a custom connector under the TOM or under the incremental refresh of Power BI would be the way to go, once it becomes available

marcosqlbi commented 7 years ago

I agree, with partitions it will be another story!