Reputation: 11
Exception while doing replaceAll
Y A M L Exception
can not read an implicit mapping pair; a colon is missed in "/home/serverless.yml" at line 144, column 99: ... ($input.body).replaceAll("\\'","'")"}'
Section of serverless.yml
, which throws error
request:
template:
application/json: '{"body": "$util.escapeJavaScript($input.body).replaceAll("\\'","'")"}'
application/xml: '{"body": "$util.escapeJavaScript($input.body).replaceAll("\\'","'")"}'
text/xml: '{"body": "$util.escapeJavaScript($input.body).replaceAll("\\'","'")"}'
response:
statusCodes:
200:
pattern: ''
template:
application/xml: '#set ($bodyObj = $util.parseJson($input.body)) $bodyObj'
400:
pattern: '400'
headers:
Content-Type: "'application/xml'"
Upvotes: 1
Views: 10829
Reputation: 76832
This:
template:[enter image description here][1]
application/json: '{"body": "$util.escapeJavaScript($input.body).replaceAll("\\'","'")"}'
is invalid YAML for various reasons.
template:[enter image description here][1]
is a scalar and then on the second line you start a mapping. Scalars are always leaf nodes in the YAML datastructure. Not sure what you actually want to do there.In
'{"body": "$util.escapeJavaScript($input.body).replaceAll("\\'","'")"}'
you should escape the single quotes withing the scalar:
'{"body": "$util.escapeJavaScript($input.body).replaceAll("\\''","''")"}'
Upvotes: 2