Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Meteor loads incorrect HTTP handler, ignores object form of the "browser" field in package.json (Manifests as XMLHttpRequest unable to load on the client) #425

Closed
raphaelarias opened this issue Apr 21, 2017 · 10 comments

Comments

@raphaelarias
Copy link

Hi, I'm getting this error when I try to do a simple query in the client.

I tried to add the protocol parameter, and few other things, but I can't find the solution for this. Obviously in the server-side, everything works just fine.

XMLHttpRequest cannot load https://api.keen.io/3.0/projects/.../queries/count. Response to preflight request doesn't pass access control check: The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'. Origin 'http://localhost:3000' is therefore not allowed access. The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute.

Thank you very much!

@dustinlarimer
Copy link
Contributor

@raphaelarias thanks for reporting! We've seen this happen on occasion when an ad-blocker is breaking the request to our API. Do you have one enabled on your browser, and would you mind testing with it disabled?

@raphaelarias
Copy link
Author

I'm not using any adblocker.

@raphaelarias
Copy link
Author

Any insight into this? For normal queries I'm routing the requests to Keen through my server (which is good because I intercept and cache the queries), but what about the data explorer tool?

@dustinlarimer
Copy link
Contributor

We haven't heard anything else of this issue, or know of anyone else specifically affected, so I would suspect an environmental issue at play. Are you wrapping the XMLHttpRequest object in any way? I'm not sure where to dig into this one.. these utilities of the SDK have been pretty heavily used for several years now.

@raphaelarias
Copy link
Author

Intersting, I'm using Meteor, but I'm not wrapping the XMLHttpRequest in any way (maybe Meteor is?).

I'll try to create a repo where we can reproduce the error.

Quick question, is keen-js the recommended NPM package to use? I may have received an information that I should use the other standalone packages (dataviz and others).

@dustinlarimer
Copy link
Contributor

Ah, ok- in that case, yes these standalone packages should help. There are some issues with superagent in meteor, which keen-js uses under the hood for HTTP requests.

Here are the new modules:

We're in the process of rolling these into keen-js as a major version bump.

@dustinlarimer dustinlarimer changed the title XMLHttpRequest cannot load on the client Meteor: XMLHttpRequest cannot load on the client Aug 25, 2017
@dustinlarimer
Copy link
Contributor

@raphaelarias we just rolled out v4 today, which bundles all of those modules together: https://github.com/keen/keen-js/releases/tag/v4.0.0

Looks like this issue is still present in Meteor: meteor/meteor#6890

@raphaelarias
Copy link
Author

Awesome! Thanks!

@dustinlarimer
Copy link
Contributor

dustinlarimer commented Sep 18, 2017

Cross-posting and adding context, this issue seems to be related to Meteor's disregard for the object form of the "browser" field in package.json: keen/keen-analysis.js#15

@dustinlarimer dustinlarimer changed the title Meteor: XMLHttpRequest cannot load on the client Meteor loads incorrect HTTP handler, ignores object form of the "browser" field in package.json (Manifests as XMLHttpRequest unable to load on the client) Sep 18, 2017
@dustinlarimer dustinlarimer removed the bug label Sep 18, 2017
@adamkasprowicz
Copy link
Contributor

meteor/meteor#9311

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants