Hi,
I have created KVM in m test environment with keys "projectId" and "region".
A "key value map" operation reads KVM and assigns values to variables "region" and "projectId". I can see the variables using trace.
Next step is a call to Cloud Function extension where I am setting input and output tags as
<Input><![CDATA[
{
"region" : {region},
"projectId" : {projectId},
"functionName" : "PostReader_GetPost",
"method" : "POST",
"payload" : {response.content}
}
]]></Input>
<Output parsed="false"> function.response </Output>
I am getting an error "{"error":"SyntaxError: Unexpected token u in JSON at position 35"}"
Please advise what should be correct syntax to be used.
PS: Following input and output values for cloud function extension work fine
<Input><![CDATA[ { "region" : "RRRRRRR", "projectId" : "xxxxxxxx", "functionName" : "PostReader_GetPost", "method" : "POST", "payload" : {response.content} } ]]></Input> <Output parsed="false"> function.response </Output>
Solved! Go to Solution.
You need to put all the variables in double quotes.
Example: {response.content} to
"{response.content}"
Final update - solved.
I had to use quotes around "{region}" and ""{projectId}" and remove quotes around "{response.content}".
Following worked
<Action>invoke</Action> <Input><![CDATA[ { "region" : "{region}", "projectId" : "{projectId}", "functionName" : "PostReader_GetPost", "method" : "POST", "payload" : {response.content} } ]]></Input> <Output parsed="false"> function.response </Output>
You need to put all the variables in double quotes.
Example: {response.content} to
"{response.content}"
@Priyadarshi Ajitav Jena,
Thank you for the suggestion
I tried that too. If I use double quote and configure CloudFunctionExtension as
<Connector>CloudFunctionExtension</Connector><Action>invoke</Action><Input><![CDATA[ { "region" : "{region}", "projectId" : "{projectId}", "functionName" : "PostReader_GetPost", "method" : "POST", "payload" : "{response.content}" } ]]></Input><Outputparsed="false"> function.response </Output>
Connector call out function response changes to
{"error":"SyntaxError: Unexpected token p in JSON at position 204"}
As noted earlier, hardcoded region and projectId works without any error
<Connector>CloudFunctionExtension</Connector><Action>invoke</Action><Input><![CDATA[ { "region" : "us-east1", "projectId" : "steam-form-NNNNN", "functionName" : "PostReader_GetPost", "method" : "POST", "payload" : {response.content} } ]]></Input><Outputparsed="false"> function.response </Output>
Any new suggestions will be highly appreciated.
Final update - solved.
I had to use quotes around "{region}" and ""{projectId}" and remove quotes around "{response.content}".
Following worked
<Action>invoke</Action> <Input><![CDATA[ { "region" : "{region}", "projectId" : "{projectId}", "functionName" : "PostReader_GetPost", "method" : "POST", "payload" : {response.content} } ]]></Input> <Output parsed="false"> function.response </Output>
User | Count |
---|---|
2 | |
1 | |
1 | |
1 | |
1 |