Support Topics Documentation Slack YouTube Blog

"Serverless 101" task 2 error using Node.js ("Dynamic schema definition")

Hi - I tried to invoke the service for Task 2 using Node.js rather than browser, and it throws an error in the purchase service as follows:

ERROR: Error: Dynamic schema definition is disabled for this application
    at new ResponseError (/Volumes/sgreene/src/nerotix/node_modules/backendless-request/lib/index.js:42:116)
    at checkStatus (/Volumes/sgreene/src/nerotix/node_modules/backendless-request/lib/index.js:237:9)
    at processTicksAndRejections (internal/process/task_queues.js:93:5) {
  code: 1169,
  status: 400,
  headers: {
    server: 'nginx',
    date: 'Mon, 26 Apr 2021 05:21:54 GMT',
    'content-type': 'application/json',
    'content-length': '99',
    connection: 'close',
    'access-control-allow-origin': '*',
    'access-control-allow-methods': 'POST, GET, OPTIONS, PUT, DELETE, PATCH',
    'access-control-expose-headers': '',
    'strict-transport-security': 'max-age=31536000; preload'
  },
  body: {
    code: 1169,
    message: 'Dynamic schema definition is disabled for this application',
    errorData: {}
  }
}

Any clues why this might be?
My code is:

const APP_ID = 'CECCF098-8DDC-EAA1-FF0A-XXXXXXXXXXXX';
const API_KEY = '1C5C1FAE-20C8-42B4-B7D1-XXXXXXXXXXXX';
const Backendless = require('backendless');
require('./CodelessShoppingCartService/js/services/CodelessShoppingCartService.js');

Backendless.initApp(APP_ID, API_KEY);
const Cart = Backendless.APIServices.CodelessShoppingCartService;

main_cart();

async function main_cart() {
    // 1. instructions
    const instructions = await Cart.getInstructions();
    console.log(instructions);

    // 2. addItem
    await Cart.addItem('testCart', {name: 'toilet paper', quantity: 1});

    // 3. getItems
    const cartContents = await Cart.getItems('testCart');
    console.log(cartContents);

    // 4. purchase
    try {
        await Cart.purchase('testCart');
    } catch(err) {
        console.log('ERROR:', err);
    }
}

(btw the system gives credit for the task; just wondering why this wouldn’t work though?)

Hello @Spencer_Greene1

Welcome to the community and thank you for trying Backandless!

You get this error because in the app the “Dynamic Schema” is disabled, try to enable it in the Data Service.

Regards, Vlad

That fixed it - thanks!
I don’t think I had intentionally turned it off though, so if the mission expects it to be turned on, you might want to include that in the instructions? cheers