Internal Server error 500 while Suitelet script https post

I am trying to post data using the https post method. However, when I run the script, I receive error code 500. Same request successfully completed through postman. How do I resolve this issue? Please help!

*@NApiVersion 2.x
*@NScriptType Suitelet
define([‘N/record’,’N/redirect’,’N/search’,’N/url’, ‘N/https’,’N/encode’,’N/ui/serverWidget’,’N/runtime’], function(record, redirect,search,url,https,encode,serverWidget,runtime) {
const tokenUrl = ‘abc’;

const apiUrl = “xyz”;

function onRequest(context){

var request = context.request;
var response = context.response;

headers = {
‘Authentication’: tokenUrl,
‘accept’: ‘application/json’,
‘Content-Type’ : ‘application/json’



var code ={
url: apiUrl,
body: body,
headers: headers


log.debug(‘code’, code);

return {
onRequest: onRequest

Beginner Asked on February 20, 2023 in SuiteScript.
Add Comment
1 Answer(s)


I see you recently asked a similar question and I have replied on that thread. Did you resolve that issue?

In any case, could please share some screenshots of your Suitelet deployment. In particular, audience, roles, etc?



Intermediate Answered on February 23, 2023.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.
  • This site made possible by our sponsors:   Tipalti   Celigo   Become a Sponsor   Become a Sponsor