Support Functions on App Hosting
Firebase Functions don't seem to be well supported in App Hosting. At least if you are using Typescript in the functions, the deploy process runs into an error in the build step. It seems to be because "npm run build" runs Typescript checking everywhere, and the dependencies in functions/package.json haven't been installed.
A user on Stack Overflow who asked about this ended up working around it by setting tsconfig.json to ignore the functions directory. They also have to do a manual deploy of the functions, because apparently the App Hosting deploy process doesn't do it.
Ideally everything should just work; type checking in functions would happen separately from the next.js code, and functions would get deployed automatically.
Here's the error from the build process:
Running "npm run build"
chatfront@0.1.0 build
next build
Attention: Next.js now collects completely anonymous telemetry regarding usage.
This information is used to shape Next.js' roadmap and prioritize features.
You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
https://nextjs.org/telemetry
▲ Next.js 15.2.1
Creating an optimized production build ...
✓ Compiled successfully
Linting and checking validity of types ...
Failed to compile.
./functions/src/index.ts:10:25
Type error: Cannot find module 'firebase-functions/v2/https' or its corresponding type declarations.
8 | */
9 |
10 | import {onRequest} from "firebase-functions/v2/https";
| ^
11 | import * as logger from "firebase-functions/logger";
12 |
13 | // Start writing functions
Next.js build worker exited with code: 1 and signal: null
Done "npm run build" (29.986122243s)