This is a simple Typescript API but, Treblle is failing to handle the request.
[error] Sending data to Treblle failed (it's possibly a network error) TypeError: function () {
let value = container[varName]
log(`will be read from the environment using "${accessor.name}" accessor`)
if (typeof value === 'undefined') {
if (typeof defValue === 'undefined' && isRequired) {
log('was not found in the environment, but is required to be set')
// Var is not set, nor is a default. Throw an error
raiseError(undefined, 'is a required variable, but it was not set')
} else if (typeof defValue !== 'undefined') {
log(`was not found in the environment, parsing default value "${defValue}" instead`)
value = defValue
} else {
log('was not found in the environment, but is not required. returning undefined')
// return undefined since variable is not required and
// there's no default value provided
return undefined
}
}
if (isRequired) {
log('verifying variable value is not an empty string')
// Need to verify that required variables aren't just whitespace
if (value.trim().length === 0) {
raiseError(undefined, 'is a required variable, but its value was empty')
}
}
if (isBase64) {
log('verifying variable is a valid base64 string')
if (!value.match(base64Regex)) {
raiseError(value, 'should be a valid base64 string if using convertFromBase64')
}
log('converting from base64 to utf8 string')
value = Buffer.from(value, 'base64').toString()
}
const args = [value].concat(Array.prototype.slice.call(arguments))
try {
log(`passing value "${value}" to "${accessor.name}" accessor`)
const result = accessor.apply(
accessor,
args
)
log(`parsed successfully, returning ${result}`)
return result
} catch (error) {
raiseError(value, error.message)
}
} is not a legal HTTP header value