bengott/meteor-avatar

Exception in template helper: TypeError: Cannot read property 'trim' of undefined

Closed this issue · 8 comments

Just encountered this error for the first time today:

Exception in template helper: TypeError: Cannot read property 'trim' of undefined
    at Object.Gravatar.cleanString (http://localhost:3000/packages/jparker_gravatar.js?7c397392549dc8d918d0cea6fc18378e402010e9:46:16)
    at Object.Gravatar.isHash (http://localhost:3000/packages/jparker_gravatar.js?7c397392549dc8d918d0cea6fc18378e402010e9:58:38)
    at Object.Gravatar.imageUrl (http://localhost:3000/packages/jparker_gravatar.js?7c397392549dc8d918d0cea6fc18378e402010e9:92:12)
    at getGravatarUrl (http://localhost:3000/packages/bengott_avatar.js?e9dfb040f26355cd260ee0d02b6836325e5b0213:328:19)
    at Object.Avatar.getUrl (http://localhost:3000/packages/bengott_avatar.js?e9dfb040f26355cd260ee0d02b6836325e5b0213:268:15)
    at Object.Template.avatar.helpers.imageUrl (http://localhost:3000/packages/bengott_avatar.js?e9dfb040f26355cd260ee0d02b6836325e5b0213:117:19)
    at bindDataContext (http://localhost:3000/packages/blaze.js?77c0809654ee3a10dcd5a4f961fb1437e7957d33:2693:16)
    at Blaze._wrapCatchingExceptions (http://localhost:3000/packages/blaze.js?77c0809654ee3a10dcd5a4f961fb1437e7957d33:1602:16)
    at Spacebars.call (http://localhost:3000/packages/spacebars.js?3c496d2950151d744a8574297b46d2763a123bdf:169:18)
    at Spacebars.mustacheImpl (http://localhost:3000/packages/spacebars.js?3c496d2950151d744a8574297b46d2763a123bdf:106:25)

Not sure why…

Weird. v0.7.0 did update to a new version of jparker:gravatar, so maybe something changed in that package. I guess I'll add another undefined/null check to make absolutely sure Gravatar doesn't run into an exception.

Added the check, published v0.7.1, and updated Telescope to 0.7.1. Let me know if it's still happening on your end.

Hmm, I think this is happening because there's no hash property on the user object. I'm getting it too.

This should be fixed. I was never able to duplicate it locally. Can anyone confirm?

assuming this is fixed since no one has complained...

I can confirm, and I've fixed in on my local copy.

The problem occurs when set up to use email hashes and the user object has no email hash.

I am still getting this error. I am not publishing the user email or the hash. Is there a way to just ignore the Gravatar image check?

I'm having this too!