question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issue with serializable-state-invariant-middleware and firebase auth state

See original GitHub issue

I’m using @reduxjs/toolkit which is pretty awesome. However, one of the cool middleware loaded in development, serializable-state-invariant-middleware complains about a couple of keys not being serializable:

A non-serializable value was detected in an action, in the path: `auth`...
A non-serializable value was detected in an action, in the path: `profile.token`...
A non-serializable value was detected in an action, in the path: `firebase.profile.token`...

This happens once authenticated, with auth loaded in state. I suppose there’s not a lot to do here, since we actually want auth to be in state, however the errors in console are quite annoying. The middleware can be actually configured to pass an array of dot-separated path strings to ignore when checking for serializability, but I was able to ignore only the third path successfully.

const configureAppStore = (preloadedState = initialState) => {
  return configureStore({
    middleware: [
      ...getDefaultMiddleware({
        thunk: {
          extraArgument: {getFirebase, getFirestore},
        },
        serializableCheck: {
          ignoredPaths: ['auth', 'profile.token', 'firebase.profile.token'],
        },
      }),
    ],
    reducer: rootReducer,
    preloadedState,
  })
}

Is the configuration wrong? Is there a better way to achieve full compatibility with firebase while still keeping the benefit of the middleware?

Here’s reproduction.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
markeriksoncommented, Feb 15, 2020

Closing as I think we resolved the issue.

0reactions
matchatypecommented, Jan 31, 2020

They come out of the react-redux-firebase bindings library, which pretty much takes care of doing the “hard work” 😅 Not that firebase auth is “difficult”, but I guess this library is to firebase pretty much like redux-toolkit is to redux.

Here: https://github.com/prescottprue/react-redux-firebase/blob/ce475bd8a9158620c0fa5069fa15f0065007ede2/src/actions/auth.js

Read more comments on GitHub >

github_iconTop Results From Across the Web

Authentication State Persistence | Firebase - Google
Indicates that the state will be persisted even when the browser window is closed or the activity is destroyed in React Native.
Read more >
firebase - How to overcome "A non-serializable value detection"
Check it out at. Getting an error "A non-serializable value was detected in the state" when using redux toolkit - but NOT with...
Read more >
Authentication | React Native Firebase
Listening to authentication state. In most scenarios using Authentication, you will want to know whether your users are currently signed-in or signed-out of ......
Read more >
The redux best practice "Do Not Put Non-Serializable Values ...
This article explains one of the four react-redux best practices: "Do Not Put Non-Serializable Values in State or Actions"
Read more >
User Registration With Firebase and React - CSS-Tricks
User Registration and Auth Using Firebase and React ... Now when we register a user the currentUser state will be set with an...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found