firebase-framework-tools
firebase-framework-tools copied to clipboard
NextJS site not getting deployed when having multi-site options
Issue: trying to get a next.js site deployed to firebase hosting when having 2 sites configured.
"hosting": [
{
"target": "web",
"public": "apps/web/public",
"ignore": ["firebase.json", "**/.*", "**/node_modules/**"],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
},
{
"target": "app",
"source": "apps/app/.",
"ignore": ["firebase.json", "**/.*", "**/node_modules/**"],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
}
],
Error received:
Error: An unexpected error has occurred

I am using lerna for monorepo approach and the nextjs app is inside app package. This approach works when there is only one site to deploy but fails in multi-site hosting when we add the target attribute.
@jamesdaniels - thoughts? An interesting case for us to explore supporting!
@fahadahmed do you see a firebase-debug log? If so would you mind sharing, right now the tooling is swallowing many exceptions under An unexpected error has occured. I need to float more to the surface.
I probably need to regenerate the log to share. Will provide soon.
Hey guys,
When trying to deploy to a multisite option, it seems that it is not recognizing the correct path of package.json. In my last line of the log before the error I have this message:
Error: ENOENT: no such file or directory, open '/Users/me/Dev/firebaseProjects/next/frameworkTest/next/frameworkTest/package.json'
The error here is that firebase repeats part of the path: next/frameworkTest (2 times)
So the correct path would be:
/Users/me/Dev/firebaseProjects/next/frameworkTest/package.json
Maybe it will help in the investigation :)
Ah that's helpful thanks.
Ah that's helpful thanks.
Hey @jamesdaniels, do you think there is any workaround for now?
Def pathing issues, I'll put together a fix for an upcoming firebase-tools release.
Trying to run a Next.js starter project and getting the same error. Also dupe in path.
[debug] [2022-07-24T08:53:44.098Z] Error: ENOENT: no such file or directory, open 'D:\Source\challenges\jg\hack\public\main\public\main\package.json'
Note the double public\main.
firebase --version
11.3.0
We've fixed some bugs with path detection, can you confirm if we've addressed the bug with the latest generation of the tooling? https://firebase.google.com/docs/hosting/frameworks-overview
Hey @jamesdaniels Thanks for the update! Of course, I will test this next weekend and I'll let you know here, thanks for your work 🥳