This topic contains 3 replies, has 0 voices, and was last updated by bjohnson@e2btek.com 7 years, 7 months ago.

  • Author
    Posts
  • #969

    bjohnson@e2btek.com

    I created a Restlet. Very simple Hello World.js

    /**

    *@NApiVersion 2.x

    *@NModuleScโ€‹oโ€‹pโ€‹e Public

    *@NScriptType Restlet

    */

    define([],function() { // NetSuite’s AMD pattern

    function onRequest_entry(context) { // Suitelet entry function receives a context obj

    context.response.write(‘Hello World’); // Write a response using the context obj

    }

    return {

    get: onRequest_entry // Function assigned to entry point

    };

    });

    I went into Customizations, uploaded the script (I saved it into the SuiteScripts Folder), and deployed it following the info in the help center.

    I then called it from Postman using the URL indicated in the Deployment record, and I get the following Error returned:

    Status 400 Bad Request

    {“error” : {“code” : “JS_EXCEPTION”, “message” : “{“type”:”error.SuiteScriptModuleLoaderError”,”nam e”:”MODULE_DOES_NOT_EXIST”,”message”:”Module does not exist: /SuiteScripts/E2BHelloWorld.js”,”stack”:[]}”}}

    Can anyone point me to what may be the issue?

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

  • #970

    david.smith

    Restlet’s use “return” unlike a suitelet that uses “response.write”

  • #971

    bjohnson@e2btek.com

    I must still be doing something wrong as I get the same error. I appreciate the help though.

  • #972

    bjohnson@e2btek.com

    OK, Figured it out. The reason for the “Module does not exist” error was due to the script record. When I uploaded the E2BHelloWorld.js (actual name of file), I did not name it with the .js extension. So it associated the non .js script name with the .js named actual file and throws the error. I deleted the script record and re-uploaded it. This time I named with the extension. Now I get a new error that it cannot call the write method of the anonymous object. This is fixed by david.smith’s post that Restlet’s use return instead of response.write (so thank you David for that).

You must be logged in to reply to this topic.