Open Siegrift opened 4 years ago
Did you solve this? I'm experiencing the same issue.
Unfortunately no, but I didn't needed that much. I use firebase and firestore and I've set it up manually inside the project (https://firebase.google.com/docs/web/setup)
So you are hosting your web app on static hosting? My Nextjs + Antd app got really slow as the size grew bigger so I thought only SSR would lift some rendering load.
I just posted a question on stackoverflow referencing this issue and a fork of your reproducible bug repo.
Yes, I am using zeit hosting (default for nextjs) and I configured firebase manually. This was the best I could do in a few days and I didn't want to spend much more on it
On Sat, 19 Oct 2019, 16:42 Maotora ᕙ(⇀‸↼‶)ᕗ, notifications@github.com wrote:
So you are hosting your web app on static hosting? My Nextjs + Antd app got really slow as the size grew bigger so I thought only SSR would lift some rendering load.
I just posted a question on stackoverflow https://stackoverflow.com/questions/58464758/firebase-cloud-functions-wont-work-with-react-hooks-on-nextjs-ssr referencing this issue and a fork of your reproducible bug repo.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/firebase/functions-samples/issues/601?email_source=notifications&email_token=AFNA44RMHW7WFVINL7FQMJ3QPMMEHA5CNFSM4IK34NF2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEBXR6EY#issuecomment-544153363, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFNA44UN4CSZAS447HQI3CLQPMMEHANCNFSM4IK34NFQ .
The problem superficially stems from two copies of the react source code. I'm not 100% sure how it works so I won't even try to explain the root cause of the problem.
To fix the problem, please place the app inside the functions folder and remove package.json. Unfortunately, all the dependencies of app must necessarily be dependencies of functions. Then, change next.config.js to this:
'use strict';
module.exports = { distDir: './next' };
and index.js to this:
const dir = __dirname + "/app" const app = next({ dev, dir, conf: {distDir: 'next'} })
Hi, I wrote the initial example. This example hasn't been kept up to date as I was maintaining my own example and the example in the nextjs repo. My most up to date example does function with React hooks if you would like to check that out https://github.com/jthegedus/firebase-gcp-examples/tree/master/functions-nextjs
How to reproduce these conditions
I have set up an example repo where you can check the bug.
Steps to set up and reproduce 1)
git clone https://github.com/Siegrift/nextjs-firebase-example
2)cd src/app
3)yarn && yarn dev
4) navigate tohttp://localhost:3000/about
You will get: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:Expected behavior
I don't think that this example is valid anymore. I was trying to figure out how to make nextjs work with firebase, but I couldn't figure it out.... Anyway, the expected behaviour is to make it work with nextjs and newest React (e.g. react hooks).
Actual behavior
Error in application and I am unable to configure nextjs with firebase.