Setting up SuiteCommerce extension developer tools for production and sandbox

On this page

You need Node.js 20.10 or later, the Extension Developer Tools zip from your account’s File Cabinet, and token-based authentication enabled in each account you deploy to. Run gulp extension:fetch --to once per account to authorise the tools in your browser and generate a .nsdeploy file, keep a copy of each one, and swap them with a script. The whole thing takes about an hour the first time, and most of that is finding values inside NetSuite.

This is the setup I use on a live SuiteCommerce Advanced storefront with a production account and one sandbox. Oracle’s docs cover one account at a time. This covers running the same tools against two without editing config by hand.

What you need before you start

RequirementMinimumHow to check
Node.js20.10.0node --version
npm10.2.3npm --version
NetSuite accessProduction and sandbox, with a role that can deploySee the token section below
Extension MechanismInstalled in both accountsCustomization > SuiteBundler > Search & Install Bundles
Token-based authenticationEnabled in both accountsSetup > Company > Enable Features > SuiteCloud

Oracle’s Install Node.js page lists the supported Node version per release. Stay close to it. The toolkit’s native dependencies are what break on a major version bump.

Token-based authentication is not optional. Since 2021.1 the developer tools no longer accept a NetSuite username and password, a change made for mandatory 2FA on Administrators. If the feature is off in either account, nothing below connects.

Install the tools

The Extension Developer Tools ship inside NetSuite, not on npm. Download the zip from the SuiteBundles folder of the File Cabinet, extract it somewhere outside your theme workspace, and install:

Bash
cd ExtensionDevelopmentTools-26.1.0
npm install
gulp help

npm install runs a postinstall step that installs gulp-cli globally. If gulp help lists tasks, the install is good. gulp: command not found means your global npm bin directory isn’t on your PATH: run npm prefix -g, append /bin, and add that directory.

Authorise the tools

There is no integration record to create and no key to copy. The first time you fetch or deploy, the toolkit asks for an authentication ID, any label you like (prod and sandbox are enough), then opens NetSuite, where you pick the account and role and click Allow. The token it generates is saved in ~/.nstba under that label, the consumer key and secret land in .nsdeploy without you seeing them, and the label is what .nsdeploy stores as authID.

A clock is running on this. Oracle’s SOAP removal FAQ says that from 2027.1 no new integrations can be built with token-based authentication, and the Commerce developer tools still require it. Existing tokens keep working. Read the release notes before you set up a new account.

Which role. Oracle’s docs say Administrator and SCDeployer both carry the permissions to fetch and deploy. Use SCDeployer where you can: it holds only what the tools need, and a role that requires 2FA at login fails with INVALID_LOGIN_ATTEMPT. If Allow fails for the user you picked, check the employee record can hold tokens before you blame the role.

Find the values the config needs

The .nsdeploy file wants six values. This table is the one I wish someone had given me.

ValueWhere to find itLooks like
Account IDSetup > Company > Company Information1234567
HostnameSetup > Company > Company Information > Company URLs, the RESTlets row1234567.restlets.api.netsuite.com
Website IDSetup > Website > Websites, the Internal ID column2
DomainSetup > Website > Domains, the active storefront domainwww.example.com
SSP folder IDDocuments > Files > File Cabinet > Web Site Hosting Files > Live Hosting Files > SSP Applications, then the id= in the URLA seven-digit number
Webapp IDUsually the same as the SSP folder ID. If a deploy fails on it, check the script deploymentsSame shape

Copy the hostname from Company URLs rather than typing it. Oracle’s page on account-specific domains says not to construct one yourself, and that it doesn’t change when the account moves data centre.

Generate the production config

You can fill .nsdeploy in by hand, but the fetch command fills most of it for you:

Bash
gulp extension:fetch --to

Without --to the toolkit reuses its last token. With it, you get the saved tokens by label and account plus a New token option, which starts the browser step above. Pick New token the first time. The tool then asks for the website and domain, downloads that domain’s activation manifest, and writes website, domain, webapp ID and SSP folder into .nsdeploy. Oracle’s fetch reference has the prompt sequence. The account comes from the token, so there is no --account flag.

Three things fetch does to your workspace. It asks before overwriting each custom extension, so answer No if you only want the config. It can only fetch custom extensions from your File Cabinet, so bundle-installed ones print “Cannot fetch packaged extension” and are skipped, which is expected. And it deletes Workspace/Extras and re-downloads the active theme into it, because extensions are compiled and validated against that copy.

That last one bit me on 26.1.0. Twice in a day the theme came back with its manifest, skins and templates but no assets folder and none of its Sass, and every deploy after that failed, first in validation and then in compile-sass with “Can’t find stylesheet to import”. The theme developer tools keep a full copy of the same theme, so copy the missing folders across:

Bash
rsync -a ThemeDevelopmentTools-26.1.0/Workspace/YourTheme/assets/  ExtensionDevelopmentTools-26.1.0/Workspace/Extras/YourTheme/assets/
rsync -a ThemeDevelopmentTools-26.1.0/Workspace/YourTheme/Modules/ ExtensionDevelopmentTools-26.1.0/Workspace/Extras/YourTheme/Modules/

Then leave extension:fetch alone until you need it, since every run wipes the folder again.

When the fetch finishes, save the file before anything else touches it:

Bash
cp .nsdeploy .nsdeploy-production

Set up the sandbox

A sandbox is a copy of production with a suffix. Oracle’s sandbox page gives the account ID pattern, _SB1, and the account-specific domain turns that into a lowercase hyphenated prefix:

ValueProductionSandbox
Account ID12345671234567_SB1
Hostname1234567.restlets.api.netsuite.com1234567-sb1.restlets.api.netsuite.com
Domainwww.example.comstaging.example.com

The toolkit’s own prompts show the sandbox as 1234567-SB1, a third spelling, so don’t be thrown that none of them match.

Tokens are the part a refresh always destroys. Oracle is explicit that every sandbox refresh means creating new tokens there, so expect to click Allow again after each one.

Copy the production file, edit the three rows above and authID, and save it. A second fetch would do the same job but wipes the Extras theme on the way:

Bash
cp .nsdeploy .nsdeploy-sandbox

What the config file looks like

The saved copies hold eight keys, and this is all you ever write by hand:

JSON
{
  "credentials": {
    "user_agent": "sc-extension-devtools/26.1.0",
    "authID": "sandbox",
    "hostname": "1234567-sb1.restlets.api.netsuite.com",
    "is_scis": false,
    "website": "2",
    "domain": "staging.example.com",
    "webapp_id": "YOUR_WEBAPP_ID",
    "ssp_folder": "YOUR_SSP_FOLDER_ID"
  }
}

authID is the label from the authentication prompt and user_agent is the toolkit’s name and version. After the browser step the live .nsdeploy gains key, secret, account and a target_folder block, written by the toolkit, so you never paste the consumer secret yourself.

.nsdeploy is the live file the gulp tasks read. The other two are your saved copies. The live one holds the consumer secret in plain text, so all three go in .gitignore before your first commit:

GITIGNORE
.nsdeploy
.nsdeploy-*

Switch environments with one command

Swapping configs is a file copy, so wrap it in npm scripts in the toolkit’s package.json:

JSON
{
  "scripts": {
    "config:sandbox": "cp .nsdeploy-sandbox .nsdeploy",
    "config:production": "cp .nsdeploy-production .nsdeploy",
    "deploy:sandbox": "npm run config:sandbox && gulp extension:deploy",
    "deploy:production": "npm run config:production && gulp extension:deploy"
  }
}

Day to day:

TaskCommand
Switch to sandboxnpm run config:sandbox
Switch to productionnpm run config:production
Deploy to sandboxnpm run deploy:sandbox
Deploy to productionnpm run deploy:production
Fetch from sandboxnpm run config:sandbox && gulp extension:fetch --to

Every flag the toolkit accepts is in Oracle’s gulp command reference.

Two things to know after the first deploy

It deploys one extension and rewrites every manifest. extension:deploy asks you to select one extension, uploads it and updates its record. On the way, an update-manifest task runs across the whole workspace: deploying one extension in a workspace of fifteen left fourteen other manifest.json files modified, reformatted and stripped of activation_id, extension_id, path and local_folder. Nothing in the source changed, and the values come back next deploy. Oracle’s deploy page documents --preserve-manifest for this, and it works: the same deploy with the flag left git status clean. Put it in your deploy scripts, as the toolkit’s own local:* scripts already do:

JSON
"deploy:sandbox": "npm run config:sandbox && gulp extension:deploy --preserve-manifest",
"deploy:production": "npm run config:production && gulp extension:deploy --preserve-manifest"

The flag has one cost. It skips the rewrite, so the deploy validates your manifests against the files on disk and refuses if they disagree. Mine refused when a fetch had left the Extras theme without its assets. The copy above fixed it. A wall of “does not exists” lines means the same thing, and the cure is the copy, not dropping the flag.

Deploying is not activating. The same page says nothing changes on the site until you activate the extension in the Manage Extensions wizard. In my experience a production activation can time out on the JavaScript step in NetSuite’s queue. It leaves the live site untouched, and a retry later the same day went through, so retry before you re-deploy.

Troubleshooting

ErrorCauseFix
cp: .nsdeploy-sandbox: No such file or directoryYou ran a sandbox script before saving the fileRun the sandbox fetch and cp .nsdeploy .nsdeploy-sandbox
Network error or authentication failureWrong credentials, a revoked token, a hostname typed by hand, or an account ID mismatchCheck the token is still active under Setup > Users/Roles > Access Tokens, then check the hostname against Company URLs
INVALID_LOGIN_ATTEMPTThe role you chose at Allow requires 2FA at loginRun --to again and choose SCDeployer
No domains offered during fetchThe domain is not set up in NetSuite yetWait for DNS, or fill webapp_id and ssp_folder by hand
Invalid domainThe config’s domain does not match Setup > Website > DomainsFix the domain, and check it belongs to the website ID in the config
Deploy fails on webapp IDwebapp_id differs from ssp_folder on this accountFind the webapp ID in Script Deployments
Extension Mechanism bundle not foundThe SuiteApp is not installed in this accountInstall it through SuiteBundler, then activate
A wall of does not exists lines for Workspace/Extras/...A fetch re-downloaded the theme without its assetsCopy assets from the theme developer tools workspace
Can't find stylesheet to import in compile-sassThe same fetch left out the theme’s SassCopy Modules from the theme developer tools workspace

This post is part of the SuiteCommerce Advanced cluster. The tools I use for this work, including the editor and terminal setup, are on the resources page.

Frequently Asked Questions

Can I use one label for both accounts?

Don't. ~/.nstba keys tokens by label, and --to lists them by label and account, so prod and sandbox tell you which account you're about to deploy to. A label is cheap and a deploy to the wrong account isn't.

Do I need a different toolkit version for each account?

No. One toolkit directory serves both, which is why the config-swap scripts work. Oracle's setup page says to download the latest zip from the SuiteBundles folder, with an older package only for Aconcagua-era accounts, so after a release upgrade check for a new zip and repeat the install step. The config files carry over.

Why does gulp extension:fetch rebuild the Extras theme?

Because extensions are compiled and validated against the active theme, and fetch refreshes that copy from the domain you choose. Your own extensions it asks about before touching. Run it once for the config, then leave it alone.

What happens to tokens after a sandbox refresh?

The sandbox is rebuilt from production, so the sandbox token is gone and your .nsdeploy-sandbox stops working. Run npm run config:sandbox && gulp extension:deploy --preserve-manifest --to, choose New token, click Allow again, and carry on with the deploy. Use deploy rather than fetch for this, because fetch wipes the Extras theme. Production is unaffected.

Working on a NetSuite project? Get in touch.