This topic contains 3 replies, has 0 voices, and was last updated by bjohnson@e2btek.com 7 years, 7 months ago.
-
AuthorPosts
-
April 7, 2017 at 3:02 pm #969
bjohnson@e2btek.comI 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. -
April 7, 2017 at 3:28 pm #970
david.smithRestlet’s use “return” unlike a suitelet that uses “response.write”
-
April 19, 2017 at 12:59 pm #971
bjohnson@e2btek.comI must still be doing something wrong as I get the same error. I appreciate the help though.
-
April 20, 2017 at 10:06 am #972
bjohnson@e2btek.comOK, 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).
-
AuthorPosts
You must be logged in to reply to this topic.