-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Closed
Description
This is a Bug Report
Description
I am trying to create a custom response template that gets uploaded in to AWS as integration responses. Currently I want the response to expose my error object as a content-type of application/json. What I've created doesn't seem to get uploaded into AWS, however writing the template directly in to AWS works.
config:
functions:
signin:
handler: credentials/authentication/signin/handler.signin
package:
include:
- lib\auth
events:
- http:
path: authentication/signin/{provider}
method: post
private: true
response:
headers:
Content-Type: "'application/json'"
template: ${file(response-template.txt)}
response-template.txt contains the following:
#set ($errorMessageObj = $util.parseJson($input.path('$.errorMessage')))
{
"status" : "$errorMessageObj.status",
"error" : {
"type": "$errorMessageObj.error.type",
"message": "$errorMessageObj.error.message",
"detail": "$errorMessageObj.error.detail",
"code": $errorMessageObj.error.code
}
}
After a successful sls deploy and making the post request that fails I get the following which is my error object as a string
{
"errorMessage": "{\"status\":\"[500]\",\"error\":{\"type\":\"API\",\"message\":\"Unexpected error has occurred.\",\"detail\":null,\"code\":6}}"
}
If I paste the template directly in to AWS I get the response formatted as I'd expect. It would appear, unless I am doing something wrong that the template is not being uploading into AWS.
Metadata
Metadata
Assignees
Labels
No labels