firebase-framework-tools icon indicating copy to clipboard operation
firebase-framework-tools copied to clipboard

NextJS site not getting deployed when having multi-site options

Open fahadahmed opened this issue 3 years ago • 8 comments

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

Screen Shot 2022-05-30 at 3 57 35 pm

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.

fahadahmed avatar May 30 '22 06:05 fahadahmed

@jamesdaniels - thoughts? An interesting case for us to explore supporting!

kirupa avatar Jun 03 '22 01:06 kirupa

@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.

jamesdaniels avatar Jun 06 '22 20:06 jamesdaniels

I probably need to regenerate the log to share. Will provide soon.

fahadahmed avatar Jun 13 '22 03:06 fahadahmed

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 :)

abMarlim avatar Jun 22 '22 21:06 abMarlim

Ah that's helpful thanks.

jamesdaniels avatar Jun 22 '22 22:06 jamesdaniels

Ah that's helpful thanks.

Hey @jamesdaniels, do you think there is any workaround for now?

abMarlim avatar Jun 23 '22 20:06 abMarlim

Def pathing issues, I'll put together a fix for an upcoming firebase-tools release.

jamesdaniels avatar Jul 12 '22 19:07 jamesdaniels

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

noga-dev avatar Jul 24 '22 08:07 noga-dev

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

jamesdaniels avatar Oct 25 '22 13:10 jamesdaniels

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 🥳

abMarlim avatar Oct 26 '22 17:10 abMarlim