I am getting a "Cannot read property ‘initApp’ of undefined when I try to initialize the Backendless object.
My project is a express/typescript server-side node.js application (not a frontend browser application). This is the way I import the library into my project:
import Backendless from ‘backendless’
Could there be an issue with es6 import statement and Backendless?
Node version: v10.13.0
Done in 62.39s.
Valodyas-MBP:sample valodya$ yarn build
yarn run v1.3.2
(node:62826) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
$ npm run tsc
Valodyas-MBP:sample valodya$ yarn start
yarn run v1.3.2
(node:62908) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
$ nodemon --watch '**/*.ts' --ignore 'node_modules/**/*' --exec ts-node src/Server.ts
[nodemon] 1.18.10
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: **/*.ts
[nodemon] starting `ts-node src/Server.ts`
/Users/valodya/Downloads/sample/src/Server.ts:12
Backendless.initApp("APP_KEY", "SECRET_KEY");
^
TypeError: Cannot read property 'initApp' of undefined
at Object.<anonymous> (/Users/valodya/Downloads/sample/src/Server.ts:12:13)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Module.m._compile (/Users/valodya/Downloads/sample/node_modules/ts-node/src/index.ts:413:23)
at Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Object.require.extensions.(anonymous function) [as .ts] (/Users/valodya/Downloads/sample/node_modules/ts-node/src/index.ts:416:12)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
at Object.<anonymous> (/Users/valodya/Downloads/sample/node_modules/ts-node/src/bin.ts:151:12)
[nodemon] app crashed - waiting for file changes before starting...