This topic contains 5 replies, has 0 voices, and was last updated by ironside 8 years, 1 month ago.

  • Author
    Posts
  • #1787

    davidturton

    I keep getting this error when trying to use the promise with https.get, any ideas?

    org.mozilla.javascript.EcmaError: TypeError: Cannot find function promise in object function (options, headers) {…}.

    https.get.promise(url: baseUrl)

    .then(function(response){

    log.debug({

    title: ‘Response’,

    details: response

    });

    })

    .catch(function onRejected(reason) {

    log.debug({

    title: ‘Invalid Get Request: ‘,

    details: reason

    });

    })
    This is a cached copy. Click here to see the original post.

  • #1788

    david.smith

    What error are you getting?

  • #1789

    davidturton

    org.mozilla.javascript.EcmaError: TypeError: Cannot find function promise in object function (options, headers) {…}.

  • #1790

    david.smith

    Your options are not formatted as and object.

    https.get.promise({ url: ‘http:s//www.testwebsite.com’ })

  • #1791

    chanarbon

    HI @davidturton,

    Aside from the that there is a problem on your formatting, I think you are performing the Promise for https module on the server side. Please note that Promise API and Promise object is currently limited to client side. As of the moment, server side scripts are limited to the synchronous processes unlike client script which is user facing. Please check out SuiteAnswers ID 43804 (https://netsuite.custhelp.com/app/an…il/a_id/43804/) for more information.

  • #1792

    ironside

    I don’t consider that a limitation at all. Look at how much messier that promise-based code is vs. the simple synchronous version.

    I don’t want server-side promises at all unless there is a distinct advantage to the developer.

    Originally posted by chanarbon

    View Post

    Aside from the that there is a problem on your formatting, I think you are performing the Promise for https module on the server side. Please note that Promise API and Promise object is currently limited to client side. As of the moment, server side scripts are limited to the synchronous processes unlike client script which is user facing.

You must be logged in to reply to this topic.