Anyone familiar with: ```type: "error.SuiteScriptE...
# suitescript
a
Anyone familiar with:
Copy code
type: "error.SuiteScriptError",
   name: "SSS_INVALID_URL",
   message: "URL protocol must be https",
I'm using the https module and the URL is a FQDN beginning with HTTPS://
b
literal in this case, HTTPS is not https
a
I'm using https:// in lower cases...
Copy code
const oAPIResponse = https.get({
    url: sAPI_URL,
    headers: {
        'Content-type': 'application/json',
        'merch-key': oAPIConfig.API_PASS,
        'Accept': '*/*'
    }
});
b
Copy code
https.get({url: '<https://panel.xxxx:7443/api/order/update/xxx/accept/'}>)
results in the expected SSS_UNKNOWN_HOST
Copy code
https.get({url: '<HTTPS://panel.xxxx:7443/api/order/update/xxx/accept/'}>)
results in SSS_INVALID_URL
a
@battk Of course, I replaced the valid values with XXX I can't share a valid host in a public space...
b
doesnt really matter, do a get to the url you gave me to get the unknown host error instead
as a comparison, do a get to any string that does not begin with https, the boring example being
Copy code
https.get({url: '<invalid://It_only_checks_what_the_url_starts_with>'})
s
could this be a silent redirect issue to an non-https endpoint?
a
@battk This is literally my code:
Copy code
const oAPIResponse = https.get({
    url: <https://panel.xxxx:7443/api/order/update/xxx/accept/>,
    headers: {
        'Content-type': 'application/json',
        'merch-key': oAPIConfig.API_PASS,
        'Accept': '*/*'
    }
});
@Shawn Talbert Most likely...
b
unlikely, what you shared isnt valid javascript, the url is missing the quotes
a
@battk And that my friend my be exactly the problem...
s
you're not using TS yet, @alien4u?
if that was the actual code TS would have given big errors, expecting a string there
though in your original code looks like you have a variable with some form of hungarian naming that suggests it should be a string
the latest webstorm has some new features around HTTP client testing- I've been using that instead of postman or other external tools lately.
a
This should be string and I should not need extra quotes... or double quotes...
Copy code
const sAPI_URL = (oAPIConfig.API_URL.endsWith('/')) ? `${oAPIConfig.API_URL}update/${pOrderNumber}/accept/` : `${oAPIConfig.API_URL}/update/${pOrderNumber}/accept/`;
b
hardcode the url to be what you think it should be
💯 1
if that succeeds, the the code you wrote isnt doing what you think it does
if it doesnt, you are really bad at urls
a
Problem solved... WebStorm automatic line breaks literally breaks ES6 template literals...
🎉 1
s
Well, more like the literal is just being literal?
😂 1
line breaks count, whether webstorm added it automatically or otherwise 🙂
a
Agree but regular string concatenation with style: "Some String" + $variable + "Some String" are not broken with manual or automatic line breaks, while ES6 are...
s
That's by design - a string literal is meant to allow us to include line breaks in a string if desired, without using special escape characters