Closed lucastnr closed 9 months ago
I changed the esbuild to format to cjs and it worked for some reason.
@lucastnr I've just released v2.0.0 of the plugin which now generates the same function template as the latest firebase-cli
/**
* Import function triggers from their respective submodules:
*
* import {onCall} from "firebase-functions/v2/https";
* import {onDocumentWritten} from "firebase-functions/v2/firestore";
*
* See a full list of supported triggers at https://firebase.google.com/docs/functions
*/
import {onRequest} from "firebase-functions/v2/https";
import * as logger from "firebase-functions/logger";
// Start writing functions
// https://firebase.google.com/docs/functions/typescript
export const helloWorld = onRequest((request, response) => {
logger.info("Hello logs!", {structuredData: true});
response.send("Hello from Firebase!");
});
Similarly to the firebase CLI approach, it is left to the user to decide how they want to boot strap their function and rewrite main.ts
accordingly.
Firebase CLI users are also left to decide if they want to use 1st or 2nd gen cloud functions (2nd gen is the default now).
One thing I'm curious about, is if initializeApp()
needs to be called with 2nd gen functions. 🤔
Added some docs about this here: https://github.com/simondotm/nx-firebase/blob/main/docs/nx-firebase-functions.md#firebase-function-projects
Closing this issue.
I'm currently migrating from 1.0.0 to 2.0.0-beta.1, mostly to achieve separated NX applications for functions.
I came across an error when I initialize the
firebase-admin
, it happens when I run eitherserve
oremulate
commands. Build works fineError message:
This works
This doesn't work
My firebase package versions
firebase
: 9.21.0firebase-admin
: 11.10.1firebase-functions
: 4.4.1