`Promise is not defined`,尝试使用 https 模块访问端点时

`Promise is not defined`, when trying to hit endpoint with https module

我正在尝试确保对 Netsuite 上的 salesOrder 所做的任何更改都反映在 Cloud Firestore 数据库中的 salesOrder 集合副本中。

出于某种原因,我在尝试编辑和保存销售订单时得到的响应是这样的 org.mozilla.javascript.EcmaError: ReferenceError: "Promise" is not defined. (/SuiteScripts/postSalesOrder-v2.js#30)

这是链接到销售订单的脚本:

/**
 * User Event 2.0 example detailing usage of the Submit events
 *
  @NApiVersion 2.x
  @NModuleScope SameAccount
  @NScriptType UserEventScript
  @appliedtorecord salesorder
 */

define(['N/https'], function(https) {
  function myAfterSubmit(context) {
    var apiURL = 'https://myApiEndpoint';
    var headers = {
      'content-type': 'application/json',
      accept: 'application/json'
    };

    https.post
      .promise({
        url: apiURL,
        headers: headers,
        body: JSON.stringify(context.newRecord)
      })
      .then(function(response) {
        log.debug({
          title: 'Response',
          details: response
        });
      })
      .catch(function onRejected(reason) {
        log.debug({
          title: 'Invalid Post Request: ',
          details: reason
        });
      });
    return true;
  }

  return {
    afterSubmit: myAfterSubmit
  };
});

服务器端 http 调用是同步的,return 是响应而不是 Promise。