Problem with Mission

Mission: CRUD ROOKIE
Task: Delete Object With API

Please, describe your problem here.

The code given in example throws a flag for undefined object. It’s copy and pasted so what gives? What am I doing wrong?

Backendless.initApp(APP_ID, API_KEY);
Backendless.Data.of(‘Person’).findFirst().then(function(object) {
object.age = Math.round(Math.random() * 50);
Backendless.Data.of(‘Person’).save(object).then(function(savedObject) {
console.log(‘Object has been updated’);
}).catch(function(error) {
console.log('Error updating object ’ + error.message);
throw error;
});
}).catch(function(error) {
console.log('Error ’ + error.message);
throw error;
});

Hello @John_Brown ,

make sure that you have provided correct APP_ID and API_KEY, also make sure that there is a record in table Person, in other case the code

Backendless.Data.of(‘Person’).findFirst().then(function(object) {

will produce undefined error, because there is no any object in the table.

i’m doing the mission. it doesn’t have Person

i been stuck here for 3 days. They never tell whether this is supposed to be a live deployment on an apache server, or if running from the IDE is sufficient. In the video he runs it from just the IDE but that doesn’t work

I literally followed his EVERY click one-by-one and it doesn’t not work.

Access to XMLHttpRequest at ‘https://api.backendless.com///services/CodelessShoppingCartService/addItem’ from origin ‘http://localhost:63342’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.
VM6:1 POST https://api.backendless.com///services/CodelessShoppingCartService/addItem net::ERR_FAILED
(anonymous) @ VM6:1
(anonymous) @ backendless.min.js:15
v @ backendless.min.js:15
b.send @ backendless.min.js:15
value @ backendless.min.js:15
value @ backendless.min.js:15
backendless.min.js:15 Uncaught (in promise) Error: Network Error
at XMLHttpRequest.i.onerror (backendless.min.js:15)
i.onerror @ backendless.min.js:15
Promise.then (async)
addItem @ controller.js:10
(anonymous) @ VM39:1
index.html:1 Access to XMLHttpRequest at ‘https://api.backendless.com///services/CodelessShoppingCartService/getItems’ from origin ‘http://localhost:63342’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.
VM6:1 POST https://api.backendless.com///services/CodelessShoppingCartService/getItems net::ERR_FAILED
(anonymous) @ VM6:1
(anonymous) @ backendless.min.js:15
v @ backendless.min.js:15
b.send @ backendless.min.js:15
value @ backendless.min.js:15
value @ backendless.min.js:15
backendless.min.js:15 Uncaught (in promise) Error: Network Error
at XMLHttpRequest.i.onerror (backendless.min.js:15)
i.onerror @ backendless.min.js:15
Promise.then (async)
getItems @ controller.js:17
(anonymous) @ VM40:1
index.html:1 Access to XMLHttpRequest at ‘https://api.backendless.com///services/CodelessShoppingCartService/purchase’ from origin ‘http://localhost:63342’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.
VM6:1 POST https://api.backendless.com///services/CodelessShoppingCartService/purchase net::ERR_FAILED
(anonymous) @ VM6:1
(anonymous) @ backendless.min.js:15
v @ backendless.min.js:15
b.send @ backendless.min.js:15
value @ backendless.min.js:15
value @ backendless.min.js:15
backendless.min.js:15 Uncaught (in promise) Error: Network Error
at XMLHttpRequest.i.onerror (backendless.min.js:15

I replied to you in this thread API Missions make no sense - #5 by Inna_Shkolnaya about the problem.

Regards,
Inna