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>
@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.
Answer by Priyadarshi Ajitav Jena · Jan 27 at 08:11 PM
You need to put all the variables in double quotes.
Example: {response.content} to
"{response.content}"
Answer by Dharmender Goyal · Jan 27 at 08:43 PM
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>