When working on your SCA modules, it's possible your code to fail first time. Knowing what to do — and what to check for — can be difficult.
Check Code Quality
- Missing commas, semicolons, brackets, square brackets, curly brackets, etc.
- Capitalization and camel case. Remember, methods, helpers, variables, etc., are all case-sensitive. It's not uncommon to get a
fooBar is undefined error because you accidentally called your variable
- Correct spelling. For example, in our tutorial module we frequently reference 'artist' and 'artists' — make sure you're using the right one. Also note that API methods can also have quite long names, which are case-sensitive too, so spelling them correctly is important.
gulp jshint --modules=Artist
You can chain additional modules to the end using commas.
For more information, see their website.
If your JS isn't behaving as expected, or there seems to be incorrect values, objects or parameters being sent to functions, put some
console.log() commands into your JS and see what's returned in the developer console. There have been a few times, for example, that putting
console.log(myVariable) has helped me find out what is going on.
SCA and Backbone-Specific Checks
If you're new to SCA (or the libraries that SCA uses, such as Backbone) you may be unfamiliar with things such as the application's structure or coding conventions.
Issues with Incorrect
define Statements (RequireJS)
When you use
, [ 'Backbone'
, function (
With that example, note the following:
- The string at the start of the statement (
Artist.List.View) must match the title of the file; if this incorrect and another file tries to call it then you'll get an error like
Uncaught TypeError: ListView is not a function.
define statements; an incorrectly typed name (or non-existent module) will return something like:
Uncaught Error: Script error for: Artist.Details.Viwe.
- In the
function we pass as parameters the names we want to use when we refer to the dependencies in the module file. Theoretically you can call them whatever you like as long as:
- The name is used consistently throughout the file.
- The order that you name them matches the order that you name them.
- Note, therefore, our naming conventions are strictly guidelines and not requirements but we strongly recommend that you adopt the same conventions to help ensure consistency. A typo or incorrect naming will likely return an error such as:
Uncaught ReferenceError: CollectionView is not defined.
Error Screen Starting with
This is caused by trying to use a module where the service does not have the
name value set in the backend model. For example, my Artist module uses the following pattern of:
, [ 'SC.Model'
, function (
, get: function(id)
, list: function()
, create: function(data)
, update: function(id, data)
, remove: function(id)
Declaring a value for
name is perhaps something you might forget to write as the others (such as
remove are functions used by the service file (and things like
list being specific to the module).
Gulp, Node and Deployment Problems
Gulp is a powerful tool in SCA development: importantly, it compiles and deploys code to the NetSuite and local servers. You can read online about general things to troubleshoot Gulp, but here are some SCA-specific ones you might encounter.
Changes Not Reflected on Local Server
If you've saved your changes and you've refreshed your local site and not seen the changes appear, the first thing you should check is that the local version of Gulp is running. Remember, you can start this by going to the parent directory of your SCA code and running
If it is running, check the URL of the page you're viewing and see if you're actually using the local .ssp file. If your session has expired and you need to log in again, it'll redirect you to the hosted version of the SSP, rather than the local one. All you need to do is change the URL, from, say,
gulp local works by 'watching' for changes to files. It's entirely possible for this process to fail if it's already running; thus, you can try stopping and restarting the service if you think it's not watching. This is necessary, in fact, if you've just added new files or directories as Gulp does not watch for new files — it only watches files that already exist.
Remember, as well, that there are a number of configuration files that are required to ensure Gulp compiles correctly:
Error: Module not found: Artist.
- distro.json — this is in the top level of your SCA folder and comes with the distribution. It informs Gulp, among other things, of all the modules to be included in the distribution before it is deployed. When adding a new module you must check that it is included in the relevant places, such as the following:
- modules — effectively the module folder location.
- tasksConfig > ssp-libraries > dependencies — the backend model you're going to be using.
- sass > applications > [name of application] > dependencies — if you're including Sass then you'll need to specify the name of the module under the application the module is being used in.
Cannot Find Service on Local Server
If you've just added a service, remember that you will need to deploy it to your hosted server as it cannot be accessed locally. If you just want to deploy your services (and not run through the full deploy sequence) you can run the following command:
gulp deploy --dev
--dev flag tells the deploy script to only upload backend code.
Old Versions of Module / Global Images are Shown
There are two things that cause this problem.
Firstly, it's possible that the image is cached in browser. Some browsers, such as Chrome, allow you to do a hard reload and cache clear on refresh (note that this is different to the 'hard reload' option. In Chrome, you need to open the developer tools open and then click and hold on the refresh icon. The "empty cache and hard reload" option will be available. You can also simulate this by simply using a private/incognito browsing session.
Secondly, you may not realise but these images are not served locally. If you've changed an image locally as part of your customization, you need to upload it to your site first. If you're unwilling to do a full deploy of your code, you can upload the changes to your site via the File Cabinet. If you don't want to overwrite the images then you could name your new images something different.
Check the Docs
As the product matures and take-up improves, we're getting more feedback from developers about the problems they encounter. As we do, we'll update the documentation around troubleshooting to help alleviate any problems you may face. Do a search for 'troubleshoot' on Developers.SuiteCommerce to find them.