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

feat(universal) : 'next is not a function' in universal environment #199

Open
ghost opened this Issue Jul 17, 2017 · 11 comments

Comments

1 participant
@ghost

ghost commented Jul 17, 2017

Do you want to request a feature or report a bug?
I want to report a bug in universal environment while server rendering. I am using the same boilerplate https://github.com/wellyshen/react-cool-starter

What is the current behavior?
The code crashes with an error after the server starts listening to the server port

What is the expected behavior?
I get this error when the server runs for the library's compose.js file which is a TypeError

to be executed: node ./index.js ==> 🌎 Listening at http://localhost:8080 GET / 500 14.907 ms - 148 TypeError: next is not a function at /Users/rahulbasu/Desktop/test-project/node_modules/react-redux-firebase/lib/compose.js:114:19 at /Users/rahulbasu/Desktop/test-project/node_modules/redux/lib/compose.js:33:18 at /Users/rahulbasu/Desktop/test-project/node_modules/redux/lib/applyMiddleware.js:51:63 at createStore (/Users/rahulbasu/Desktop/test-project/node_modules/redux/lib/createStore.js:64:33) at exports.default (/Users/rahulbasu/Desktop/test-project/src/redux/store.js:35:24) at /Users/rahulbasu/Desktop/test-project/src/server.js:60:17 at Layer.handle [as handle_request] (/Users/rahulbasu/Desktop/test-project/node_modules/express/lib/router/layer.js:95:5) at next (/Users/rahulbasu/Desktop/test-project/node_modules/express/lib/router/route.js:137:13) at Route.dispatch (/Users/rahulbasu/Desktop/test-project/node_modules/express/lib/router/route.js:112:3) at Layer.handle [as handle_request] (/Users/rahulbasu/Desktop/test-project/node_modules/express/lib/router/layer.js:95:5)

Which versions of dependencies, and which browser and OS are affected by this issue? Did this work in previous versions or setups?

Nope. For universal environment with https://github.com/wellyshen/react-cool-starter

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Jul 17, 2017

I also get a similar error when installing the 2.0.0-beta specifically. In the project I have added the required code in the store.js and reducer.js files with the respective parts and in the store I have put it inside the enhancers file with the firebaseConfig and config vars assigned respectively above as mentioned in the tuts.

const enhancers = [ applyMiddleware(...middlewares), reactReduxFirebase(firebaseConfig, config), __DEV__ && typeof window === 'object' && typeof window.devToolsExtension !== 'undefined' ? window.devToolsExtension() : f => f, ];

Error: v2.0.0-beta and higher require passing a firebase instance. View the migration guide for details. at /Users/rahulbasu/Desktop/test-project-2/node_modules/react-redux-firebase/lib/compose.js:24:15 at /Users/rahulbasu/Desktop/test-project-2/node_modules/redux/lib/applyMiddleware.js:38:19 at createStore (/Users/rahulbasu/Desktop/test-project-2/node_modules/redux/lib/createStore.js:64:33) at module.exports.__webpack_exports__.a (/Users/rahulbasu/Desktop/test-project-2/build/server.js:467:1227) at /Users/rahulbasu/Desktop/test-project-2/build/server.js:393:1157 at Layer.handle [as handle_request] (/Users/rahulbasu/Desktop/test-project-2/node_modules/express/lib/router/layer.js:95:5) at next (/Users/rahulbasu/Desktop/test-project-2/node_modules/express/lib/router/route.js:137:13) at Route.dispatch (/Users/rahulbasu/Desktop/test-project-2/node_modules/express/lib/router/route.js:112:3) at Layer.handle [as handle_request] (/Users/rahulbasu/Desktop/test-project-2/node_modules/express/lib/router/layer.js:95:5) at /Users/rahulbasu/Desktop/test-project-2/node_modules/express/lib/router/index.js:281:22

ghost commented Jul 17, 2017

I also get a similar error when installing the 2.0.0-beta specifically. In the project I have added the required code in the store.js and reducer.js files with the respective parts and in the store I have put it inside the enhancers file with the firebaseConfig and config vars assigned respectively above as mentioned in the tuts.

const enhancers = [ applyMiddleware(...middlewares), reactReduxFirebase(firebaseConfig, config), __DEV__ && typeof window === 'object' && typeof window.devToolsExtension !== 'undefined' ? window.devToolsExtension() : f => f, ];

Error: v2.0.0-beta and higher require passing a firebase instance. View the migration guide for details. at /Users/rahulbasu/Desktop/test-project-2/node_modules/react-redux-firebase/lib/compose.js:24:15 at /Users/rahulbasu/Desktop/test-project-2/node_modules/redux/lib/applyMiddleware.js:38:19 at createStore (/Users/rahulbasu/Desktop/test-project-2/node_modules/redux/lib/createStore.js:64:33) at module.exports.__webpack_exports__.a (/Users/rahulbasu/Desktop/test-project-2/build/server.js:467:1227) at /Users/rahulbasu/Desktop/test-project-2/build/server.js:393:1157 at Layer.handle [as handle_request] (/Users/rahulbasu/Desktop/test-project-2/node_modules/express/lib/router/layer.js:95:5) at next (/Users/rahulbasu/Desktop/test-project-2/node_modules/express/lib/router/route.js:137:13) at Route.dispatch (/Users/rahulbasu/Desktop/test-project-2/node_modules/express/lib/router/route.js:112:3) at Layer.handle [as handle_request] (/Users/rahulbasu/Desktop/test-project-2/node_modules/express/lib/router/layer.js:95:5) at /Users/rahulbasu/Desktop/test-project-2/node_modules/express/lib/router/index.js:281:22

@prescottprue prescottprue self-assigned this Jul 17, 2017

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Jul 17, 2017

@wellyshen can you help or is it just a part of the library?

ghost commented Jul 17, 2017

@wellyshen can you help or is it just a part of the library?

@prescottprue

This comment has been minimized.

Show comment
Hide comment
@prescottprue

prescottprue Jul 19, 2017

Owner

@rahulbasu710 It is currently a main piece of the library. I will look into what is a common pattern for doing this in a universal environment.

Open to suggestions here if anyone has input or wants to make a PR.

Owner

prescottprue commented Jul 19, 2017

@rahulbasu710 It is currently a main piece of the library. I will look into what is a common pattern for doing this in a universal environment.

Open to suggestions here if anyone has input or wants to make a PR.

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Jul 19, 2017

Sure. Not a problem!
Thanks. And keep me updated. Eagerly waiting for the update to use observables aith Firebase as your library seems to be the only one that does it.

ghost commented Jul 19, 2017

Sure. Not a problem!
Thanks. And keep me updated. Eagerly waiting for the update to use observables aith Firebase as your library seems to be the only one that does it.

@prescottprue

This comment has been minimized.

Show comment
Hide comment
@prescottprue

prescottprue Jul 19, 2017

Owner

@rahulbasu710 Not sure if you have seen it, but you should already be able to use redux-observable as shown in the docs:

Could have been what you were referencing? Either way, still going to look into the universal stuff.

Owner

prescottprue commented Jul 19, 2017

@rahulbasu710 Not sure if you have seen it, but you should already be able to use redux-observable as shown in the docs:

Could have been what you were referencing? Either way, still going to look into the universal stuff.

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Jul 19, 2017

Yup I have already seen it. But if the library as a whole doesn't work with universal, I can't use it ryt. So am waiting for the compatibility to implement it in my project with redux-observable as observables are at the core. Right now I am using out of the box observable and standard firebase but too many actions to write. I hope your library with universal compatibility will definitely help me solve that.
Thanks

ghost commented Jul 19, 2017

Yup I have already seen it. But if the library as a whole doesn't work with universal, I can't use it ryt. So am waiting for the compatibility to implement it in my project with redux-observable as observables are at the core. Right now I am using out of the box observable and standard firebase but too many actions to write. I hope your library with universal compatibility will definitely help me solve that.
Thanks

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Jul 19, 2017

I was just thinking that since the library for universal should be running on both the server and the client but Firebase on the server runs with just Admin SDK. So is it necessary to include the Admin SDK somewhere to get rid of the error (specifically for Universal environment only)? Just a thought

ghost commented Jul 19, 2017

I was just thinking that since the library for universal should be running on both the server and the client but Firebase on the server runs with just Admin SDK. So is it necessary to include the Admin SDK somewhere to get rid of the error (specifically for Universal environment only)? Just a thought

@prescottprue

This comment has been minimized.

Show comment
Hide comment
@prescottprue

prescottprue Jul 19, 2017

Owner

@rahulbasu710 It hopefully should help with that, it was one of the main goals behind creating it 😄

Not sure that is it with the admin sdk, I believe that is due to how the middleware is setup.

Owner

prescottprue commented Jul 19, 2017

@rahulbasu710 It hopefully should help with that, it was one of the main goals behind creating it 😄

Not sure that is it with the admin sdk, I believe that is due to how the middleware is setup.

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Jul 19, 2017

haha yup, as I have told you before, it really is an incredible match of great stuff.

Can you give me a little more clue about the middleware part.
Are you saying about the project i'm using or the implementation of the middleware in the library?

ghost commented Jul 19, 2017

haha yup, as I have told you before, it really is an incredible match of great stuff.

Can you give me a little more clue about the middleware part.
Are you saying about the project i'm using or the implementation of the middleware in the library?

@prescottprue

This comment has been minimized.

Show comment
Hide comment
@prescottprue

prescottprue Jul 19, 2017

Owner

@rahulbasu710 I reached out over Gitter so we can more quickly chat back and forth.

Owner

prescottprue commented Jul 19, 2017

@rahulbasu710 I reached out over Gitter so we can more quickly chat back and forth.

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Jul 19, 2017

Sure man

ghost commented Jul 19, 2017

Sure man

@prescottprue prescottprue added this to the Future v1.*.* milestone Aug 9, 2017

@prescottprue prescottprue removed their assignment Aug 9, 2017

@prescottprue prescottprue changed the title from 'next is not a function' in universal environment to feat(universal) : 'next is not a function' in universal environment Aug 24, 2017

@prescottprue prescottprue changed the title from feat(universal) : 'next is not a function' in universal environment to bug(universal) : 'next is not a function' in universal environment Aug 24, 2017

@prescottprue prescottprue changed the title from bug(universal) : 'next is not a function' in universal environment to feat(universal) : 'next is not a function' in universal environment Aug 24, 2017

@prescottprue prescottprue added this to To Do in Future Versions Dec 22, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment