- Newest
- Most votes
- Most comments
Based on the documentation, here are a few things to consider when returning errors from an AWS AppConfig extension:
Returning a generic error string like
"This is an error"
will cause the deployment to fail but may not provide useful information on the nature of the error.
Throwing an exception will also cause failure but the error message may not be clear.
Returning an object with an
error
property like
{error: 'string'}
allows the deployment to continue while signaling an error occurred.
The status code returned from an extension is not important as AppConfig does not actually handle HTTP responses. Status codes are used in examples but can be any value.
Returning structured error data as JSON may help provide more context, for example
{message: 'Error message', details: 'Additional details'}
.
Ensure any custom objects or types returned can be serialized properly to avoid unexpected errors being thrown.
Relevant content
- asked 8 months ago
- asked a year ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 6 months ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 10 months ago
return { message: 'Error message' } // AppConfig ignores and continues on return { error: { message: 'Error message' } } // AppConfig ignores and continues on return { Content: { message: "Error Message' } } // AppConfig errors with 'Unknown Error: null' return JSON.stringify({ message: 'Error message'}) // AppConfig errors with 'Unknown Error: null' return { error: JSON.stringify({ message: 'Error Message' }) } // AppConfig ignores and continues on return { Content: JSON.stringify({message: 'Error Message' }) } // AppConfig errors with Illegal white space character return { Content: Buffer.from(JSON.stringify({message: 'Error Message'}).toString('base64') } // AppConfig replaces my entire configuration with the error message, but doesn't error return Buffer.from(JSON.stringify({message: 'Error Message'}) Nothing even shows up in logs, and any structured data, that i've found, returned from extension is completely ignored except for the variable 'Content'. AppConfig just keeps deploying like nothing happened. If there is a structured way to send back an error message, I haven't found one. And there doesn't seem to be any documentation on it.
I was hoping someone might know how to return a descriptive error message to the interface.
I could throw an exception and print the error to logs... but i find that cumbersome to search through cloudwatch logs when the interface errors, just with an 'Unknown' error. Plus we have to give that user access to the logs for the extension..