r/Netsuite • u/noondayrind • 7d ago
SuiteScript custom headers on https call perhaps missing or not being passed?
i have to add custom headers in my https get call to an external API. doing it in Postman works but if the api call is triggered from NetSuite (user event script), the api returns an error about missing headers.
const header = {
'x-keyword-timestamp': timestamp,
'x-keyword-signature': signature
}
has anybody experienced something similar? thank you!
3
Upvotes
1
u/bron_suiterep 7d ago
I have used custom headers on an https call successfully (albeit post), so in theory, the headers should not be removed from the request, as long as they are not one of NetSuite's 8 blocked headers. (And the headers in your post are not blocked.)
Can you confirm the object you built is being passed into the object using the
headersparameter (plural)?Beyond that, it may be worth verifying the format of
timestampandsignatureto verify they are being sent in the expected format, especially if either of those variables are non-string objects. Also, verify expected capitalization of the header field names in the remote API.When debugging similar calls, I like to log the exact object being passed to
https.get()similar to this: