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

Elasticsearch is trying to access loggedin user's "profile" property, which returns null #714

Closed
jykae opened this issue Dec 15, 2015 · 5 comments
Assignees
Labels

Comments

@jykae
Copy link
Contributor

jykae commented Dec 15, 2015

Found a bug from the recent develop version, I am getting error from elasticSearch.js from line 22.

Exception while invoking method 'getChartData' TypeError: Cannot read property 'profile' of null
I20151215-14:02:54.605(2)? at [object Object].Meteor.methods.getChartData (server/methods/elasticSearch.js:22:1)

@jykae jykae added the bug label Dec 15, 2015
@brylie
Copy link
Contributor

brylie commented Dec 16, 2015

@jykae please provide some steps to reproduce. Is this when you deploy? What is the context around this error?

@brylie
Copy link
Contributor

brylie commented Dec 16, 2015

@frenchbread is the chartsLayout template used in any route(s) where anonymous users can access?

We may need to make sure the user is logged in before the getChartData method is envoked, otherwise there needs to be a try catch around the failing code.

@frenchbread
Copy link
Contributor

If i'm recalling correctly, chartsLayout template is not used in any routes. It is used in a dashboard template only. (Did some some search for chartsLayout occurrences within the project folder).

Tested this issue locally by calling Meteor.call("getChartData") and got similar error:

Exception while invoking method 'getChartData' TypeError: Cannot read property 'profile' of null

Seems like when deploying, getChartData gets called for some reason.

Agreed that error handling is needed there. What about checking if user isLoggedIn inside getChartsData method:

if (Meteor.user())
    // continue getting charts data
else
   // terminate

@frenchbread
Copy link
Contributor

Created a hotfix. Please review & test.

This should fix the problem now.

@brylie
Copy link
Contributor

brylie commented Dec 17, 2015

@frenchbread great work!

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