Good Morning, I'm working with 2019.1 Extensions a...
# suitecommerce
s
Good Morning, I'm working with 2019.1 Extensions and currently trying to work with a service, I created the Extension which created the serviceController and the entry point file, then I created the Backend Model as well. After Deploying and activating the Extension when the services is executed I get this response: "<strong>Javascript is disabled on your browser.</strong><br>To view this site, you must enable JavaScript or upgrade to a JavaScript-capable browser." I have a Execution Log in the service controller which never logs, so I believe the Service is not calling the Service Controller. Maybe I need to add something to the entry point file to execute the service controller?
Also I checked the Service file in the backend and makes a require to a ServiceController file but has the wrong name, I tried to change that but did not work either
s
The most likely explanation is that the file names are not correct. The developer tools automatically names the service file [ModuleName].Service.ss and the service controller [ModuleName].ServiceController.ss. However, the 'JavaScript' names of these might be different, such as [VendorName].[ExtensionName].[ModuleName].ServiceController.
👍 1
You will need to make the name of the service matches the one you are calling in your model (or view or whatever). I would also check what has been uploaded to the file cabinet.
s
The name of the service in the model matches the one in the backend, it executes the service but then the service doesn't execute the Service Controller for some reason. Where can I look the files uploaded in the file cabinet?
k
@Santiago In the extensions folder for local dev, there's a folder called assets which contains an SS file. Confirm that the refence to you service is correct. I have had that issue in the past.
s
If it's been uploaded correctly, it'll be in your web site hosting files. For example, I have one here: Web Site Hosting Files : Live Hosting Files : SSP Applications : NetSuite Inc. - SCA 2019.2 : Development : extensions : SteveGoldberg : DownloadOrderCSV : 1.0.1 : services
It could also be in your SuiteScripts folder under Deploy_Extensions
Also the error from the response will contain more information than just "JavaScript is disabled on your browser". If the service accepts GETs then you can copy and paste the URL into a new browser window and view the response there
s
@Steve Goldberg It's been uploaded correctly I have put the "Javascript"name of the Service Controller as it is in the Require of the Service.ss. And keep getting the same response in the Network tab:
Copy code
<!DOCTYPE html><html lang="en-US" class="touch"><head>

	<!--[if !IE]><!-->
	
			<link rel="stylesheet" href="http://cap.pablodominguez.com/sca-src-2019-1/extensions/shopping_5.css?t=1565923110299">
	
	<!--<![endif]-->
	<!--[if lte IE 9]>
<link rel="stylesheet" href="http://cap.pablodominguez.com/sca-src-2019-1/extensions/ie_shopping_0_5.css?t=1565923110299">
<link rel="stylesheet" href="http://cap.pablodominguez.com/sca-src-2019-1/extensions/ie_shopping_1_5.css?t=1565923110299">
<link rel="stylesheet" href="http://cap.pablodominguez.com/sca-src-2019-1/extensions/ie_shopping_2_5.css?t=1565923110299">

	<![endif]-->
	<!--[if lt IE 9]>
		<script src="/sca-src-2019-1/javascript/html5shiv.min.js"></script>
	  	<script src="/sca-src-2019-1/javascript/respond.min.js"></script>
	<![endif]-->

	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
	<link rel="shortcut icon" href="http://cap.pablodominguez.com/sca-src-2019-1/extensions/SuiteCommerce/Suite_Commerce_Base_Theme/19.1.0/img/favicon.ico">
	<title></title>

</head>

<body class=" seo-support">

<noscript>
	<div class="shopping-layout-no-javascript-msg">
		<strong>Javascript is disabled on your browser.</strong><br>
		To view this site, you must enable JavaScript or upgrade to a JavaScript-capable browser.
	</div>
</noscript>

<div id="main" class="main" style="display: block;"></div>

<script>
function Deferred(){this.status='started';this.data=undefined;this.doneCb=[]}Deferred.prototype.done=function(fn){if(this.status==='resolved'){fn(this.data)}else{this.doneCb.push(fn)}};Deferred.prototype.resolve=function(data){this.data=data;this.status='resolved';for(var i=0;i<this.doneCb.length;i++){this.doneCb[i](this.data)}return this};Deferred.all=function(deferreds){var keys=Object.keys(deferreds);var numberOfResolvedDeferreds=0;var toReturn=new Deferred;for(var i=0;i<keys.length;i++){deferreds[keys[i]].done(function(){numberOfResolvedDeferreds++;if(numberOfResolvedDeferreds===keys.length){toReturn.resolve()}})}return toReturn};function loadJSON(url,resourceName){window.loadedResourcesPromises=window.loadedResourcesPromises||{};var promise=new Deferred;window.loadedResourcesPromises[resourceName]=promise;var http=new XMLHttpRequest;http.open('GET',url);http.onreadystatechange=function(){if(http.readyState===4&&http.status===200){promise.resolve(JSON.parse(http.responseText))}};http.send(null);return promise}function isObject(item){return item&&typeof item==='object'&&!Array.isArray(item)}function merge(target,source){if(isObject(target)&&isObject(source)){var sourceKeys=Object.keys(source);var sourceKey;for(var i=0;i<sourceKeys.length;i++){sourceKey=sourceKeys[i];if(isObject(source[sourceKey])){if(target[sourceKey]===undefined){target[sourceKey]=source[sourceKey]}else{merge(target[sourceKey],source[sourceKey])}}else{target[sourceKey]=source[sourceKey]}}}return target};function _each(values,fn){for(var i=0;i<values.length;i++){fn(values[i],i)}};var SC=<http://window.SC|window.SC>={ENVIRONMENT:{jsEnvironment:typeof nsglobal==='undefined'?'browser':'server'},isCrossOrigin:function(){return'<http://cap.pablodominguez.com|cap.pablodominguez.com>'!==document.location.hostname},isPageGenerator:function(){return typeof nsglobal!=='undefined'},getSessionInfo:function(key){var session=SC.SESSION||SC.DEFAULT_SESSION||{};return key?session[key]:session},getPublishedObject:function(key){return SC.ENVIRONMENT&&SC.ENVIRONMENT.published&&SC.ENVIRONMENT.published[key]?SC.ENVIRONMENT.published[key]:null}};if(!history.pushState&&SC.ENVIRONMENT.jsEnvironment==='browser'&&(location.pathname!=='/'||location.search!=='')&&location.hash===''){if(location.pathname==='/'){var hash=(RegExp('fragment='+'(.+?)(&|$)').exec(location.search)||[,''])[1];location.replace(location.pathname+location.search+'/#'+unescape(hash))}else{location.replace('/#'+location.pathname+location.search)}document.write('')}if(!SC.isCrossOrigin()){if(!navigator.userAgent.match(/googlebot/i)){document.getElementById('main').style.display='none'}if(SC.isPageGenerator()){document.body.className=document.body.className+' seo-support'}SC.ENVIRONMENT.seoSupport=!!~document.body.className.indexOf('seo-support');if(SC.isPageGenerator()){SC.ENVIRONMENT.PROFILE={}}if(SC.ENVIRONMENT.jsEnvironment==='browser'&&!SC.isCrossOrigin()){var googletagmanager_cookie='';if(!googletagmanager_cookie){var value='; '+document.cookie;var parts=value.split('; _gid=');if(parts.length===2){googletagmanager_cookie='&_ga='+parts.pop().split(';').shift()}}var datetime=new Date().getTime();loadJSON('<http://cap.pablodominguez.com/sca-src-2019-1/services/ShoppingUserEnvironment.Service.ss?lang=en_US&cur=null&X-SC-Touchpoint=shopping'+googletagmanager_cookie+'&t='+datetime+'','shoppingUserEnvironment').done(function(env)>{merge(SC,env);if(SC.PROFILE_PROMISE){SC.PROFILE_PROMISE.resolve(SC.ENVIRONMENT.PROFILE)}})}}
</script>

<script src="/sca-src-2019-1/public/shopping.environment.ssp?lang=en_US&cur=null&X-SC-Touchpoint=shopping&t=1565923110299"></script>
<script src="/sca-src-2019-1/public/shopping.environment.shortcache.ssp?X-SC-Touchpoint=shopping&t=1565923110299"></script>
<script src="/sca-src-2019-1/languages/shopping_en_US.js?t=1565923110299"></script>


	<script src="/cms/3/cms.js" defer=""></script>



		<script src="/sca-src-2019-1/extensions/shopping-templates_5.js?t=1565923110299"></script>

		<script src="/sca-src-2019-1/javascript/shopping.js?t=1565923110299"></script>

		<script src="/sca-src-2019-1/extensions/shopping_5.js?t=1565923110299"></script>


<script>
try{if(!window.loadedResourcesPromises){require(['SC.Shopping.Starter'])}else{Deferred.all(window.loadedResourcesPromises).done(function(){try{require(['SC.Shopping.Starter'])}catch(e){document.getElementById('main').style.display='block'}})};}catch(e){if(document.getElementById('main')){document.getElementById('main').style.display='block'}}
</script>




<!-- SuiteCommerce Advanced [ prodbundle_id "273662" ] [ baselabel "SCA_2019.1" ] [ version "2019.1.5" ] [ datelabel "2019.08.20" ] [ buildno "3" ] -->
<!-- 437 s: 13% #39 cache: 4% #112 -->
<!-- Host [ sh7.prod.sv ] App Version [ 2019.2.0.132 ] -->
<!-- COMPID [ TSTDRV1942041 ] URL [ /s.nl ] Time [ Mon Jan 20 11:03:10 PST 2020 ] -->
<!-- Not logging slowest SQL -->
</body></html>
HTML which only has the No Javascript message
s
This is the exact response of the service file? I've never seen it just return what looks the skeleton of the application before
Can you send me the request URL?
s
Right, well, this is a 404. Your service file has not been put in the right place. After creating the extension, you've activated it, right?
s
Correct, the file is in the backend though
s
If you've deployed it through an extension then it probably won't be available at the URL you've specified. I'm curious as to how you're generating your URL for it. For example, in your file are you using
_.getAbsoluteUrl(getExtensionAssetsPath('services/TVG.InventoryByLocation.Service.ss'))
s
Ok wasn't using the getExtensionsAssetsPath, but got the same result, then I went to the backend to see the URL differences between what I got and the backend URL. I was using the Dev url to test the service but the deploy and activation set the extension service in the Source folder. Is this correct? Can I deploy the Extension to the development folder?
s
If your service is part of an extension then that it is where it should live. If you want to manually copy it to somewhere else in the file cabinet you could, but that's not exactly good practice