// background/test/generate.ts
import type { PlasmoMessaging } from "@plasmohq/messaging"
import { httpsCallable } from "firebase/functions"
import { functions } from "~firebase"
const handler: PlasmoMessaging.MessageHandler = async (req, res) => {
const generateMessage = httpsCallable<any, any>(
functions,
"generateMessage"
)
console.log("Calling the method")
const response = await generateMessage()
console.log("Response " + JSON.stringify(response))
res.send({
response
})
}
export default handler
// background/test/generate.ts
import type { PlasmoMessaging } from "@plasmohq/messaging"
import { httpsCallable } from "firebase/functions"
import { functions } from "~firebase"
const handler: PlasmoMessaging.MessageHandler = async (req, res) => {
const generateMessage = httpsCallable<any, any>(
functions,
"generateMessage"
)
console.log("Calling the method")
const response = await generateMessage()
console.log("Response " + JSON.stringify(response))
res.send({
response
})
}
export default handler