Task 2 of Serverless 101 problems

Mission: SERVERLESS 101
Task: Invoke the API Service using generated client SDK

Please, describe your problem here.

i have downloaded the sdk from the business logic section and also the aditional files from the task objective. And as the video mentions i have unzipped them to the same location.
Not the problem comes. The problem is that i dont get any response when i clink on any link buttons that the task says to click on and instead i get a uncaught error and other times some other error.
The most common is the uncaughterror. I am new to javascript so i followed the video yet i cant make it work. The error (uncaught error) show this
controller.js:2 Uncaught TypeError: Cannot read property ā€˜getInstructionsā€™ of undefined
at getInstructions (controller.js:2)
at :1:1

and the same thong with the quoted text different is shown to me on everypress

Hi. Provide, please, your appId.

i couldnā€™t get youā€¦

Your are working with backendless application. Each app has its own identifier ā€“ application id.
We need to know what is the application-id of your app to help you.

21CCA188-C007-C369-FFD2-9E8365E89600
the app would be the ā€œcodelessshoppingcartserviceā€

The name of your app is SKILLZ ?

Hello, @Newrade_CO

try this one:

Backendless.APIServices.CodelessShoppingCartService.getInstructions()

Regards, Vlad

now i have been getting this
GET file://api.backendless.com/sdk/js/latest/backendless.min.js net::ERR_FILE_NOT_FOUND
Uncaught ReferenceError: Backendless is not defined
at CodelessShoppingCartService.js:17

please send me the archive you downloaded

CodelessShoppingCartService.rar (1.6 MB)

there might be some non essential lines of code as i was trying to figure out the problemā€¦

I can reproduce the issue, and I just created an internal ticket BKNDLSS-22389 to fix it.

as a workaround I can propose you the following:

replace body in your index.html file with this:

<body>
    <a href="javascript:getInstructions()">Get Instructions</a>
    <a href="javascript:addItem()">Add Item</a>
    <a href="javascript:getItems()">Get Items</a>
    <a href="javascript:purchase()">Purchase</a>
    <div id="output">

    </div>
    <script src="http://api.backendless.com/sdk/js/latest/backendless.min.js"></script>
    <script src="js/services/CodelessShoppingCartService.js"></script>
    <script src="js/controller.js"></script>
<script type="text/javascript">
  const appId = 'YOUR_APP_ID';
  const apiKey = 'YOUR_API_KEY';

  Backendless.initApp(appId, apiKey);
</script>
</body>

Regards, Vlad

2 Likes

thanks alot

When you have time pls update auto generated SDK files, issue is still there. Applied your solution and worked like a charm! Thanks!

Hello @Nicolo_Ammendola

Thanks for your report, we are working on it.