Closed NiharikaBaliboyna9 closed 10 months ago
Hello @NiharikaBaliboyna9 . Sorry for any inconvenience with the library. Can you trying accessing the underlyingError
?
E.g error.underlyingError
Hey
The lambda function needs to return an object containing message and code and this will map accordingly to what aws-amplify has defined in their lib.
Check this -> https://github.com/aws-amplify/amplify-js/blob/main/packages/core/src/clients/serde/json.ts#L26-L37
Also, it might remain an open issue since, if you do send the x-amzn-errortype header, in the react app, you will still not be able to grab it since it's being uppercased. ( So as a resolution, the header should also be checked against uppercase version, like X-AMZN-ERRORTYPE ).
PS:...but as I said before, you can send the code property in the mean time ( while the header issue is solved )
@NiharikaBaliboyna9, thanks for opening this issue. It looks like it's a duplicate of the previously opened #12730 and a known bug that we are already tracking and working on a fix for!
I'll close this issue as a duplicate (since the other issue has more context/comments) and ask that any additional comments be made there
CC: @dorin-moldoveanu-assist, and thank you for that additional context!
Before opening, please confirm:
JavaScript Framework
React
Amplify APIs
REST API
Amplify Categories
api
Environment information
Describe the bug
When trying to parse out the repsonse from errors that are returned from a rest api and amplify is wrapping our errors in an
Expected behavior
In v5 the following is logged
Reproduction steps
v6
Code Snippet
Log output
aws-exports.js
No response
Manual configuration
No response
Additional configuration
No response
Mobile Device
No response
Mobile Operating System
No response
Mobile Browser
No response
Mobile Browser Version
No response
Additional information and screenshots
No response