bendotcodes / cookies

Load and save cookies within your Web application
MIT License
143 stars 15 forks source link

Warning: Failed prop type: Invalid prop `cookies` of type `Cookies` supplied to `CookiesProvider` #151

Closed SachaG closed 6 years ago

SachaG commented 6 years ago

After upgrading to 2.1.5 for react-cookie and universal-cookie-express, I'm getting the following warning on the server:

Warning: Failed prop type: Invalid prop `cookies` of type `Cookies` supplied to `CookiesProvider`, expected instance of `Cookies`. 
in CookiesProvider

Any idea what could be going on?

See code here: https://github.com/VulcanJS/Vulcan/blob/devel/packages/vulcan-routing/lib/server/routing.jsx#L54

eXon commented 6 years ago

Hi @SachaG

Thanks for reporting this. I love your open-source work by the way and how generous you are with the community =).

If you log req.universalCookies before passing it to the CookiesProvider, is it defined and an instance of the Cookies class?

What was your version before 2.1.5? Was it a 2.X or a 1.X?

Have a great day!

SachaG commented 6 years ago

I had 2.1.4 for react-cookie and 2.1.2 for universal-cookie and universal-cookie-express. I just tried 2.1.6 for react-cookie and haven't seen the error so far though, so maybe it's fixed?

eXon commented 6 years ago

I'm guessing this is fixed. Let me know if it's not the case!

mikitasavanovich commented 6 years ago

@eXon Hi. I'm still experiencing this issue. req.universalCookies is a Cookies object, but neither react-cookie nor universal-cookie exports a Cookies class that is in a prototype chain of req.universalCookies object. I'm using 2.2.0 versions for all three packages (universal-cookie, react-cookie, universal-cookie-express).

eXon commented 6 years ago

@mikitasavanovich Are you using universal-cookie-express? Would you mind sharing your code?