-
Notifications
You must be signed in to change notification settings - Fork 27k
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
Firebase example: couldn't find a pages
directory
#8893
Comments
@ijjk the project structure is very similar to the with-firebase-hosting example. Yes, I'm running |
Quick note: I can run next as [edit] |
Can confirm it's an issue in 9.0.7 when using |
same problem for me trying to deploy to firebase |
I'm seeing this too, arising from a docker config that starts the app from a few directories above the app directory (for which I've previously set the As a workaround, it appears that I can literally |
Working again in v9.0.8-canary.0, thanks for fixing so quickly guys! |
I am using 9.0.6 and can confirm this error as well. It was working before and then suddenly just broke itself. Cost me 2 days of debugging. Thank god someone finally reported this on Github... Tried updating to 9.0.8-canary.0 and still got the error. Rolling back to 9.0.4 for now. |
I am using 9.0.6 and can confirm this error as well. It was working before and then suddenly just broke itself. Cost me 2 days of debugging. Thank god someone finally reported this on Github... Tried updating to 9.0.8-canary.0 and still got the error. Rolling back to 9.0.4 for now.
How do you start your next app? Do you use a src folder?
Before 9.0.7 if you wanted to use a src folder you had to use a workaround and start your Next application like this `next src`. Since 9.0.7 they added official support and you can get rid of the last argument and start your app like this `next`.
|
I'm using NextJS with firebase functions, so when I deploy I use next build src/client |
Same here, with latest canary ( FWIW, I'm able to skip the 'pages' directory error by adding But then I run into a "Could not find a valid build in the '[project root]/.next' directory!" error, which is weird since my And finally, |
@notthatnathan I tried what seems to work for you but it's not working for me.
Nothing works :-/ |
@xaphod Maybe you are missing to set your node environment to
or by directly setting it in next configuration in next({ dev: false }) |
works fine for me |
Is this getting fixed someday? I'm having the same issue, seems it's been a while. |
@ryudice what worked for me:
|
Do you people actually have acceptable performance using a Firebase Function (in reallity just a Google Cloud Function behind the scenes)? I ended up switching to a e2-micro instance on Google Cloud (just a vm) with the next.js app running 24/7. For my use case this is acceptable money wise, and I don't need the theoretical infinite scalability of a cloud function to be honest. After all the config fighting and testing, I just feel it's not there yet. In theory it seemed like a good idea and a nice one as well (firebase deploy and there you go). This is my own experience with my current projects, so take this with a grain of salt. 🤷♂ |
@scottie-schneider I'm having the same issue but using node 10 and latest next version did not fix it for me :( are you using the latest typescript or regular example? |
@ryan-0 sorry for late response here. Have you tried adjusting the cloud functions permissions level (my next post after the one you tried)? |
Thanks for your replay @scottie-schneider! I figured it out in the end, it was an issue with the |
@scottie-schneider |
This is still happening for me, and the only way I've been able to fix it is by setting const dev = process.env.NODE_ENV !== 'production';
const app = next({
dev,
// the absolute directory from the package.json file that initialises this module
// i.e.: the absolute path from the root of the Cloud Function
conf: { distDir: 'dist/client' },
}); |
@mattgabor then just set the flag directly as: next({ dev: false }) And delete: const dev = process.env.NODE_ENV !== 'production'; That way you could still use NODE_ENV. |
I see, thanks @Ferezoz. I thought always disabling dev mode would prevent hot reloading or source maps when running |
What is the recommended solution for this issue? |
there is not solution for me
On Tue, 7 Jul 2020 at 11:56, Sascha Heyer ***@***.***> wrote:
What is the recommended solution for this issue?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#8893 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAHIVCY4FHVOD6SF3XBCZLR2LWMBANCNFSM4I3OKXTQ>
.
--
<nacho/>
|
Likely not the issue for most above, but I got the same error message when I changed my dev script from |
Setting NODE_ENV to |
This is still happening for me. Currently using version 10.0.3.
Error: If I remove /app and use the following folder structure, it works:
|
So the issue is actually pretty clear to me.
And here is were we see the error. Each request rebuilds the app. Therefore it deletes the contents of That is why you don't have see the issue when running in production—because the build persists I am not sure how to fix this though and TBH I am not even sure if serving via emulator is meant for development mode?! EDIT I read through the "hidden comments" in this issue and from what I understand cloudfunction emulation is not for nextjs development mode therefore we all should set |
As @maerzhase says, running the app in dev mode on the Firebase Emulator Functions will cause a rebuild each time your app changes which invalidates the build dir which the Function loads next from in "server" mode. You do not need to run your app on the Functions in the emulator to be able to use the emulator with your app. When you initialise Firebase inside your Next app, you can use this method defined in the local emulator docs to connect your simple https://firebase.google.com/docs/emulator-suite/connect_and_prototype#web_1 var db = firebase.firestore();
if (location.hostname === "localhost") {
db.useEmulator("localhost", 8080);
} The Firebase SDK supports this method of emulator connection for each of the services it hosts, Auth, Fucntions, Firestore etc. I recommend reading these docs - https://firebase.google.com/docs/emulator-suite/ I would however recommend running the app in the Cloud Function with the prod output ( |
This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Bug report
My project has a custom structure but so far it worked pretty well. Since I updated to v9.0.7 I get this error:
Error: > Couldn't find a
pagesdirectory. Please create one under the project root at Object.findPagesDir [...]
So far running
next src/app
worked just fine. Is there anything different I should do now?Screenshot
System information
The text was updated successfully, but these errors were encountered: