Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Uncaught error: Cannot read property 'apply' of undefined on Beta4 #159

Closed
luandro opened this issue Nov 7, 2015 · 11 comments
Closed
Assignees

Comments

@luandro
Copy link

luandro commented Nov 7, 2015

Debug: internal, implementation, error
[1]     TypeError: Uncaught error: Cannot read property 'apply' of undefined
[1]     at Object.createLocation (/Users/luandropvieira/Sites/hapi-universal-redux/node_modules/history/lib/useQueries.js:99:45)
[1]     at /Users/luandropvieira/Sites/hapi-universal-redux/node_modules/redux-router/lib/server.js:52:40
[1]     at /Users/luandropvieira/Sites/hapi-universal-redux/node_modules/redux-router/lib/matchMiddleware.js:21:13
[1]     at /Users/luandropvieira/Sites/hapi-universal-redux/node_modules/redux-router/lib/matchMiddleware.js:27:13
[1]     at Object.dispatch (/Users/luandropvieira/Sites/hapi-universal-redux/node_modules/redux-router/lib/replaceRoutesMiddleware.js:15:16)
[1]     at /Users/luandropvieira/Sites/hapi-universal-redux/src/server.js:93:9
[1]     at /Users/luandropvieira/Sites/hapi-universal-redux/node_modules/hapi/lib/request.js:397:22
[1]     at iterate (/Users/luandropvieira/Sites/hapi-universal-redux/node_modules/hapi/node_modules/items/lib/index.js:36:13)
[1]     at Object.exports.serial (/Users/luandropvieira/Sites/hapi-universal-redux/node_modules/hapi/node_modules/items/lib/index.js:39:9)
[1]     at /Users/luandropvieira/Sites/hapi-universal-redux/node_modules/hapi/lib/request.js:392:15

Got this error on Beta4, it's gone when reverted back to Beta3.

@omnidan
Copy link
Contributor

omnidan commented Nov 7, 2015

@luandro can you post a gist with the code that produces this error? 😁

@luandro
Copy link
Author

luandro commented Nov 7, 2015

hope it's readable 🎱 !

I can't get client to match server btw... checksum is always invalid

@omnidan
Copy link
Contributor

omnidan commented Nov 7, 2015

@luandro thanks! would be great if you could put it in a repo instead so it's easy to reproduce 😅 I didn't think it'd be that much 😛

@luandro
Copy link
Author

luandro commented Nov 7, 2015

@omnidan here's a repo.

git clone -b next https://github.com/luandro/hapi-universal-redux.git
cd hapi-universal-redux

npm install
npm run dev     # to start node server and hot server
npm i [email protected] # install beta-4 to see the error
npm run dev

@luandro
Copy link
Author

luandro commented Nov 7, 2015

Actually I just cloned my own repo, and I get the error even with beta3.
I'll close this for now and investigate further.

@luandro luandro closed this as completed Nov 7, 2015
@omnidan
Copy link
Contributor

omnidan commented Nov 7, 2015

@luandro hope you figure it out, feel free to open a new issue if it turns out to be redux-router related 😄

@mattkrick
Copy link

This was caused when I didn't pass in a createHistory function to reduxReactRouter.
To fix it:
const store = reduxReactRouter({routes, createHistory})(createStore)(rootReducer, initialState);

The lack of a createHistory function should probably throw an error both in reduxReactRouter as well as in the history package if there is no createHistory param passed in (can make a PR if needed, but given the PR backlog, I don't know if it's worth it)

Stack trace:

    at Object.createLocation (/Users/mk/Code/kanbanReactStarter/node_modules/history/lib/useQueries.js:99:45)
    at /Users/mk/Code/kanbanReactStarter/node_modules/redux-router/lib/server.js:52:40
    at /Users/mk/Code/kanbanReactStarter/node_modules/redux-router/lib/matchMiddleware.js:21:13
    at /Users/mk/Code/kanbanReactStarter/node_modules/redux-router/lib/matchMiddleware.js:27:13
    at Object.dispatch (/Users/mk/Code/kanbanReactStarter/node_modules/redux-router/lib/replaceRoutesMiddleware.js:15:16)
    at /Users/mk/Code/kanbanReactStarter/build/webpack:/src/server/server.js:51:9

@Scarysize Scarysize self-assigned this Nov 8, 2015
@Scarysize
Copy link
Contributor

react-router will throw you an error as far as I can see.
Will give me:
Uncaught TypeError: createHistory is not a function

[email protected]

@mattkrick what is your react-router version. Could you test if this is still a issue for you?

@mattkrick
Copy link

I just checked again, still doesn't throw, react-router isn't part of the stack trace.
"react-router": "^1.0.0-rc3",
"redux-router": "^1.0.0-beta4",

@Scarysize
Copy link
Contributor

Can you throw together a gist or give me repo to reproduce the error?

@mattkrick
Copy link

Sure thing: https://gist.github.com/mattkrick/08dff8474882f01993fb

After line 3 it shouldn't matter since it breaks at creating the store

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants