redux-auth: Cannot read property 'getIn' of undefined
I’m getting error when rendering
<OAuthSignInButton
provider=...
endpoint=... />
I’m specifying both required provider and endpoint props, but I get this error:
Uncaught TypeError: Cannot read property 'getIn' of undefined
About this issue
- Original URL
- State: open
- Created 8 years ago
- Reactions: 1
- Comments: 34 (6 by maintainers)
Commits related to this issue
- quick fix for cannot read property 'getIn' of undefined reference: https://github.com/lynndylanhurley/redux-auth/issues/20 — committed to hsinhoyeh/redux-auth by hsinhoyeh 7 years ago
I got the same error, which seemed to be caused by not having the reducer specified
It’d be nice if it handled this a bit better, either handling the null value, or returning an error telling people what to do. Also, the instructions in the README don’t mention setting up the reducer. The example app certainly has it in there, but it also has a lot of other stuff that a real app doesn’t need.
Hi @lynndylanhurley ,
I just hardcoded every container of redux-auth so it access the auth state like this:
And is working, I believe that if we isolate the selector in a module so it handles the immutable case (like in my previous post) for the meanwhile, then we could further give the users the ability to customize this selector. If you guide me a bit I could help you with a PR.
@arjshiv - thanks for sending that detailed example.
@nyjy85 was right - the problem is that the redux-auth components expect there to be a normal javascript object called
authat the root level of your store. Her comment above explains the problem you’re having.In your application, the entire store is an Immutable.js
Map, and the redux-auth components don’t know how to read that.I’ll try to include a fix this for the next release, but it will be a bit of work and I’m not sure when it will be ready by.
It looks like you’ve included @hhhonzik’s workaround:
But it doesn’t seem to be solving the problem.
@hhhonzik - was there anything else you needed to do to work past this issue?
Is anyone still thinking about this? I’ve hit the same issue and would rather pick up where you left off than start from scratch 😃
No worries, appreciate the help!
On Tue, Jul 26, 2016 at 11:33 AM Lynn Dylan Hurley notifications@github.com wrote:
No worries, I’ll have a test repo up and hopefully you can help me debug. BTW, I love what you’ve done, and I have my fingers crossed that I’ll be able to use it once we get past this 😃
Hey @nyjy85,
I came across the same issue and there is a problem with initialState being undefined or plain object.
You can just wrap authStateReducer with initial immutable state like this: