I am developing an Firebase Functions.
But when I try to deploy the Functions, it failed.
At first time, I followed the official guide document: HERE
The sample code is using like:
import {
onDocumentCreated,
Change,
FirestoreEvent
} from "firebase-functions/v2/firestore";
But when I tried to deploy the functions, I faced the below error:
Error: Failed to load function definition from source: Failed to generate manifest from function source: SyntaxError: Cannot use import statement outside a module
I tried to find solution, and I found it.
So I fixed the line.
as is
import {
onDocumentCreated,
Change,
FirestoreEvent
} from "firebase-functions/v2/firestore";
to be
const {onDocumentCreated} = require("firebase-functions/v2/firestore");
But after that, the error was changed to:
Error: Failed to load function definition from source: Failed to generate manifest from function source: Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './v2/firestore' is not defined by "exports" in /{my-repo}/functions/node_modules/firebase-functions/package.json
What should I do???
There is no longer any mention of it in the official documentation.
What am I missing?