I'm trying to run a Next.js app on Firebase App Hosting, and running into some errors on deploy.
The first error came from the npm command that it uses to install Node dependencies. The command it uses is shown in the logs as:
Running "npm ci --quiet --no-fund --no-audit (NODE_ENV=development)"
(I assume (NODE_ENV=development) is not part of the actual command line)
In my app I thought I needed to add a flag to that command, but I found a workaround (setting an option in the .npmrc).
But I haven't found a good solution to the next error I encountered. This came from the fact that it doesn't automatically build and deploy Firebase Functions. I would have thought this would just work, since it's Firebase, but it doesn't seem to even try. When it runs "npm run build" to build the Next.js app, that does Typescript checking, which fails in the functions directory because that has separate dependencies in its own package.json that need to be installed.
This person on Stack Overflow had the same problem and never got an answer; their workaround is to set up tsconfig.json to ignore the functions directory and do a separate, manual deploy of the functions.
The best thing would be for App Hosting to automatically do the right thing when there is a functions directory.
The second best thing would be to let the developer modify the commands used in the build process. In fact I suspect there might be a way, but it seems to be undocumented. This seems like an important feature whether or not it turns out to be necessary for my use case.
(Gemini told me I could add a build.commands section in apphosting.yaml, but it didn't work; I guess it was hallucinating.)
So am I missing something that would let me customize the commands?