MichaelErmer / eveonlinejs

Node.js/io.js EVE API Client
MIT License
27 stars 4 forks source link

Stopped working #7

Closed janat08 closed 8 years ago

janat08 commented 8 years ago

Upgraded to newer Node, or maybe eve api changed? Requested account chars.

janat08 commented 8 years ago

Although it may be networking problems on my side.

vorpalhex commented 8 years ago

Can you post the specific error?

janat08 commented 8 years ago

I haven't got a clue as to how to debug, Im very slowly migrating to graphql, so that hopefuly may help with debugging?

On Tue, Sep 6, 2016 at 10:34 PM, Derrick notifications@github.com wrote:

Can you post the specific error?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/MichaelErmer/eveonlinejs/issues/7#issuecomment-245009686, or mute the thread https://github.com/notifications/unsubscribe-auth/AKz-gQjtX72RvtphpZhLKYSfW9EwJRb3ks5qnZYWgaJpZM4J0q9g .

vorpalhex commented 8 years ago

Given a function call of:

eveonlinejs.fetch('eve:SkillTree', function(err, result)....

Post your 'err' object from the callback function

janat08 commented 8 years ago

It is null, yikes. I have a problem then all of my own.

janat08 commented 8 years ago

Got the courage to actually try and debug this and it gave me this: XMLHttpRequest cannot load https://api.eveonline.com/account/Characters.xml.aspx?keyID=5005462&vCode=6Hm4xAM7C7Nt8weIYXXQjTfysiGkAetHTRPScMQ2A7ZCze96jg9r2Qz4dzKtVIKA. A wildcard '*' cannot be used in the 'Access-Control-Allow-Origin' header when the credentials flag is true. Origin 'http://localhost:3000' is therefore not allowed access. The credentials mode of an XMLHttpRequest is controlled by the withCredentials attribute.

vorpalhex commented 8 years ago

Is this in Node or front-end JS?

janat08 commented 8 years ago

Im running this on meteor so it simulates the call on either, previously running only on server. The thing stopped working like 6 month ago.

janat08 commented 8 years ago

I haven't got a clue as to how to follow guidelines with the header stuff and things, so maybe got banned even though I'd like make a call one a week or something.

MichaelErmer commented 8 years ago

Its no issue with the library, its a nodejs npm, no client lib.

If you want to use it with meteor you have to put the eveonlinejs call into a server side method, which you then call from the client but it is executed on the server, like:

if (Meteor.isServer) {
  Meteor.methods({
    fetchEveApi: function() {
      var Future = Npm.require("fibers/future");
      var fut = new Future();
      eveonlinejs.fetch('eve:SkillTree', Meteor.bindEnvironment(function(err, result) {
        fut.return(result);
      }));
      return fut.wait();
    }
  });
}

NOTE: It's better to put it into the /server directory than using Meteor.isServer.

and then from the client you do:

Meteor.call('fetchEveApi', function(err, result) {
  console.log(result);
});
janat08 commented 8 years ago

What i have: Meteor.bindEnvironment(function(err, result) { if (err) { throw err; } var chars = result.characters;

I'm also got if this is simulation return which stops client from doing eve api stuff, but it worked before, and I haven't done anything to the code.

MichaelErmer commented 8 years ago

You are right I forgot the bind, see my updated answer above. Join tweetfleet slack (https://www.fuzzwork.co.uk/tweetfleet-slack-invites/) for more help, I closed the issue because its no issue with the library itself.