Backendless.Messaging.publishSync is not a function

i’m getting this error now. not there before.

Uncaught TypeError: Backendless.Messaging.publishSync is not a function

How do you import Backendless SDK for JS into your app?

<script src="https://api.backendless.com/sdk/js/latest/backendless.min.js"></script>

This is not a good idea since whenever library changes, it may impact your code (like now). The blocking methods had been deprecated for a while and in version 6.0 (the latest one), they have been removed. Rather than importing from /latest/, you should import a specific version of the library, for example, this should work for you:

<script src="https://unpkg.com/backendless@5.9.4"></script>

We describe in the docs how to import a specific version of the library.

Regards,
Mark

you guys should put a warning on the docs that its no longer supported

It is still supported in all versions prior to 6.0. There has bee a warning for about a year now in your code that the functions are deprecated.

Regards,
Mark

Nothing that i can see even now.
and i still think a big red warning in the JS docs will help others in the future :slightly_smiling_face:

Hello @mohammad_altoiher

We have been printing the following warnings in browser’s console for more that two years, see when it was added Use Backendless Request (#107) · Backendless/JS-SDK@4a08b55 · GitHub

To get almost same result in your code you can use async/await which is support by all modern browsers

const result = await Backendless.Messaging.publish('default', { foo: 123, message: 'hello' })

Regards, Vlad

1 Like