Start a new topic

Common library not included anymore

Hey guys,


since the day before yesterday evening (European time) my business scripts using lodash (a better underscore) fail caused by not finding the library which is still included in common: ReferenceError: _ is not defined


I did not update anything, so looks like that some of your changes affected this?

Is anyone else experiencing that?


Thanks a lot and greetings from Hamburg

Marcel


Thanks a lot for your report Marcel, 


We will look into this. 


Greetings from Boston :)

found a solution myself. Still, could you please explain what did you change and is it an expected behaviour? Thanks!


Solution:

change lodashs outer function to a self executing function, return _ as last command and set variable _.

E.g. for the minified verison, as the normal version is too large (no error from kinvey, just old verison is used):


// ATTENTION: ADDED MANUALLY TO WORK WITH KINVEY

var _ = function init(){


function n(n,t){if

... normal code ...

(Pn.exports=Zn)._=Zn:Dn._=Zn:Yn._=Zn


// ATTENTION: ADDED MANUALLY TO WORK WITH KINVEY

;return Dn._}();

Marcel,  


Apologies again about the slow reply, I had a sick day yesterday and I am still a bit under the weather.   To give you a bit more insight as to why this isn't working....


We have recently upgraded Business Logic to act and feel considerably more like node.   So now when you use Lodash, it is trying to add a module to node (which is presently disallowed) which will fail with the referenceError that you got above.   That said, your code was expecting the result of the lodash in (this) which is not true. 


The recommended action is to generally avoid underscore.js as it has the potential to run in to a fair amount of compatibility issues within kinvey.  The workaround you've made will work and accomplish the results you are after (as you've likely noticed by now) and is something that others could implement to work around the issue that you ran into.


If you have any additional questions or concerns, please let me know.

Thanks Damien! Get well soon!


I would guess that lodash/underscore are fairly often used with kinvey as well. Would be a good idea to include it in the kinvey modules like async etc.! JS cannot handle collections nicely out of the box, so this would really help.


Thanks!

Marcel

btw: is there any way I can get a heads-up on such breaking changes?

Marcel:


In this case we didn't actually make a major release that we expected to break anything.   We have been doing a considerable amount of user testing.  In general you can reach out to support and get a response fairly quickly.   The time offset between Germany and the East Coast of the USA made this hard, since our overnight resource wasn't working last night, and I was behind a day due to taking a sick day.   Generally our response times are 30 minutes - 1 hour during 9-5 EDT business hours, and a little longer outside of that.


As always, if you have any questions, comments, or concerns, please feel free to reach out.


Thanks,


Login or Signup to post a comment