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

.node yields incomplete JSON objects #86

Open
volkanunsal opened this issue Jan 19, 2016 · 3 comments
Open

.node yields incomplete JSON objects #86

volkanunsal opened this issue Jan 19, 2016 · 3 comments
Labels

Comments

@volkanunsal
Copy link

Recently, the node method has been returning non-JSON strings to the callback function and I can't figure out why. This used to work before. My function looks like this:

oboe(this.options.url)
      .node('features.*', (f) => {
      });

The JSON object from the server looks like this:

{
 "type": "FeatureCollection",
  "features": [
    {"id": 1}, {"id": 2}, {"id": 3}
  ]
}

The first time it returns a correct object. But the second and third time this function is called, the results are malformed. Any idea what might be going on?

@volkanunsal
Copy link
Author

I am also observing that occasionally there are errors like this:

Uncaught TypeError: Cannot read property '0' of undefined ./~/oboe/dist/oboe-browser.js:122 

Looks like it's coming from here.

@JuanCaicedo
Copy link
Collaborator

@volkanunsal could you try this using the function keyword instead of ES6's fat arrows? My suspicion is that since you are able to work with this inside the node callback, the Oboe code also uses this. Using the fat arrow changes the binding on this, which changes it for all the later instances.

Just a hunch though, hopefully we can verify if that's the case!

@tmkujala
Copy link

I've also started seeing the same TypeError when running under node:

TypeError: Cannot read property '0' of undefined
    at /app/node_modules/oboe/dist/oboe-node.js:121:33

Any idea what the root issue is here?

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

No branches or pull requests

3 participants