Backendless.CustomServices is undefined

I have a custom service hosted on the business logic tab. When I download the javascript API, sometimes CustomServices is undefined and it crashes because it can’t call invoke. This is the line that crashes it: Backendless.CustomServices.invoke. I’m not sure why. I don’t change any code. It’s just sometimes it works and sometimes it doesn’t. Any idea what could be happening?

Hi,

I think this can happen if javascript SDK is loaded asynchronously and sometimes does not have time to initialize. Make sure that the library is always loaded before the init method is called.

Regards,
Stanislaw

Thank you. Problem is resolved.