A quick help needed, Getting the below error when...
# suitecommerce
m
A quick help needed, Getting the below error when trying to call the SS 2.0 backend service Request
Copy code
var model = new SCATrainingExtensionSS2Model();
model.fetch({}).then((response) => console.log({response}));
Response
Impossible to parse backend error - Request {"url":"https:/abc.com/extension_ss2/extensions/Vendor/Extension/1.0.0/Modules/Extension/SuiteScript2/Extension.Service.ss?c=abc123&n=1","type":"GET","isLocal":false,"global":true,"processData":true,"async":true,"contentType":"application/x-www-form-urlencoded; charset=UTF-8","accepts":{"*":"*/*","text":"text/plain","html":"text/html","xml":"application/xml, text/xml","json":"application/json, text/javascript","script":"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},"contents":{"xml":{},"html":{},"json":{},"script":{}},"responseFields":{"xml":"responseXML","text":"responseText","json":"responseJSON"},"converters":{"text html":true},"flatOptions":{"url":true,"context":true},"jsonp":"callback","cache":true,"dataType":"json","parse":true,"data":"","emulateHTTP":false,"emulateJSON":false,"dataTypes":["text","json"],"crossDomain":false,"hasContent":false}
b
Can you post the code in the service? Generally that means that you are not getting data from the model.
s
There’s something wrong with your request
There might be more information in the execution log in NetSuite
👍 1
And yeah, if you want to post your code then that would be helpful
m
This is the code that I added for testing SS 2.0 service code
Copy code
/**
* @NApiVersion 2.x
* @NModuleScope Public
*/
define(['N/log'], function (log) {
    "use strict";

    function service (context) {
        log.debug('SCATrainingExtension -> method', context.request.method);
        var response = {};

        switch (context.request.method) {
            case 'GET':
                //response = SCATrainingExtensionModel.get(context.request)
                break;
        }

        context.response.write(JSON.stringify(response));
    }

    return {
       service: service
    };
});
And there is nothing in the execution log (as seen in the screenshot).
Got it working. Just changed the ssp v2 url root to
extension_ss2
.
🙂 1
👍 1
b
You changed that in your js model file right?
m
No just changed the SSP v2 URL ROOT i.e. the url should be same as SSP v1 but just with
_ss2
suffix.
b
I’m sorry but I’m which file?
m
From NS UI: Commerce -> Hosting -> SSP Applications -> SuiteCommerce Advanced - Dev 2021.2.0 v2 (Edit) -> Url Root -> Save Undeploy SSP from Site Shopping or Domain if you not already have.
🙌 1