The key issue here is the difference between treating a parameter as a string literal versus a column reference or expression.
Explanation:
-
'Bearer ' + $AuthString
:- In this case,
$AuthString
is treated as a column reference or expression, not as a literal value. The error suggests that column operands are not allowed in literal expressions, which indicates that the system is expecting a literal string but is instead interpreting$AuthString
as something else.
- In this case,
-
'Bearer ' + '$AuthString'
:- Here,
'$AuthString'
is treated as a literal string, meaning the literal stringBearer $AuthString
will be used in the header. This is why you don’t get a syntax error, but the resulting HTTP request fails with a 401 unauthorized error, as the literal string doesn’t represent a valid authorization token.
- Here,
Solution:
To properly concatenate the string literal 'Bearer '
with the parameter $AuthString
, you should ensure that the parameter is being correctly interpolated as a string. This can be achieved by using the string()
function to explicitly convert the parameter to a string within the expression.
Correct Expression:
headers: ['authorization' -> ('Bearer ' + string($AuthString))],