Closed pillarshadow closed 4 years ago
hi,
this is an interesting case, but i don't have any realms with underscores so i can't test it, i don't know how the signatures will work in your case
can you try modifying netsuite-rest.js locally:
add following line in constructor ( after line 13)
this.base_url = options.base_url;
replace following line ( # 50)
let uri = https://${this.realm}.suitetalk.api.netsuite.com/services/rest/${path}${url}
with this:
this.base_url ? uri = `${this.base_url}/services/rest/${path}` : uri = `https://${this.realm}.suitetalk.api.netsuite.com/services/rest/${path}`
^ please try, let me know if it works
Okay, I added this line to the constructor after line 13:
this.base_url = options.base_url;
Then I tried replacing line 50 with the line of code you had but it didn't quite work.
I think it was just because of the way uri was being set with the ternary operator.
I instead used this line and it works:
let uri = this.base_url ? `${this.base_url}/services/rest/${path}` : `https://${this.realm}.suitetalk.api.netsuite.com/services/rest/${path}`
Also, thank you for making this library!
great! it worked, i have committed these changes
My realm needs to look something like this: 1234567_SB1.
If I set that as the realm, it tries to make requests to this url: https://1234567_sb1.suitetalk.api.netsuite.com/
but the URL needs to be 1234567-sb1.suitetalk.api.netsuite.com
The URL needs to have a hyphen in it while the realm needs to have an underscore.
I think there should be an option to specify the url and the realm separately if you want to.
I'm thinking maybe if there were something like a base_url option and then if it isn't specified, continue to just assume it is safe to use the realm in the url but if it is specified, use the base_url.