CloudCode Dependencies


A few Node.js packages are included by default in every CloudCode task. This includes:

  • aws-sdk

  • node-fetch (exposed as a fetch global function)

Additional Node.js dependencies can be added to a task or managed via OXIDE. See the following section for details:

pageManage External Dependencies

Private NPM Packages

CloudCode supports the addition of private NPM packages to be used in tasks. To do this, you need to:

  1. Update the task's package.json file with the relevant details for the private package you are using.

  2. Add an access token for your org in the task's .npmrc file. To do this, open the task's .npmrc file and add this line: //$NPM_TOKEN - where $NPM_TOKEN is your NPM user's access token.

  3. Update the yarn.lock file (right-click on the CloudCode task in OXIDE or use the command palette).

Using dependencies

Once dependencies are added to the task, they can be imported and used in the task:

import * as Rollbar from 'rollbar';
const rollbar = new Rollbar({
  accessToken: process.env.POST_SERVER_ITEM_ACCESS_TOKEN,
  captureUncaught: true,
  captureUnhandledRejections: true
}); // Read more about process.env in our Enviroment variable docs.

export async function run() {
  try {
    let res = await fetch('')
    if (res.ok) {"Fetched");
    } else {
      throw new Error(`request to failed, reason: ${res.status} ${res.statusText}`);
  } catch (err) {
    rollbar.error(`Unable to fetch got '${err.message}'`, err);

Last updated