Having recently delved into NGRX, I am attempting to transfer an error thrown in an effect to an action and store the error object. While this functionality appears to work smoothly on my local setup, it encounters an issue once deployed on the server:
Error: Detected unserializable action at "error". https://ngrx.io/guide/store/configuration/runtime-checks#strictactionserializability
The structure of my action is as follows:
export const loginFailed = createAction(
"[Login dialog] User log in failed",
props<{error : any}>()
);
Within my effect's catch statement:
catchError((error) => of(AuthActions.loginFailed({error : error})))
This situation raises several queries:
Why does this error only arise on the server and not during local testing?
What causes the "any" type for error to be non-serializable?
Are there more effective methods for transferring errors to the store?
I experimented with specifying the "Error" interface as the type for the error within the action props, yet encountered the same error.
In investigating ngrx documentation, I could not locate any resources pertaining to error objects or their management.