TypeError: Cannot read properties of null (reading 'mongoClient')

I have a Card component, it’s basically a bootstrap card with a button. I m trying to use that button to save the data from the card into my mongodb. It works in local but fails in heroku. Why is failling and how could I fix it?

Thanks in advance.

Hi @Puzzle_Dots ,

When using the realm web sdk you have to first authenticate a user before getting a client.

See the following guide to initiate authentication before you try to get a client:


1 Like

Thanks @Pavel_Duchovny !
This is how it looks “the final implementation”, I hope it could help others. It is the raw simplest and dummiest as possible to figure it out how to implement Realm from real-web into React.

Again, thank u so much!