nuxt/framework

How to add additional firebase functions when deploying nuxt to firebase

hputzek opened this issue · 0 comments

Environment

  • Operating System: Darwin
  • Node Version: v16.13.1
  • Nuxt Version: 3.0.0-27324955.23397e6
  • Package Manager: npm@8.3.0
  • Bundler: Vite
  • User Config: css, meta, vite, https, ssr
  • Runtime Modules: -
  • Build Modules: -

Reproduction

Prerequisites: A nuxt3 project, e.g. https://codesandbox.io/s/github/nuxt/starter/tree/v3-codesandbox

  • Run NITRO_PRESET=firebase npm run build

  • The firebase function for running nuxt is generated in .output/server

  • In /firebase.json the following config is set:

{
"functions": { "source": ".output/server" },
}

Info: functions.source cannot be set to multiple paths

Nuxt exports only a single function which includes the nuxt build:

/.output/server/index.mjs:

// [...]
const server = functions.https.onRequest(handle);
export { server };

Describe the bug

Not a bug but a question:

Is there a way to add/include additional firebase functions that are output to .output/server when running nuxi build?

I want to add a custom firebase function which is deployed to firebase in addition to the nuxt-function when running firebase deploy.

But the folder .output/server which contains the functions to be deployed is autogenerated by nuxi build.
This is also true for the package.json file in .output/server

I know I can also implement middleware & API endpoints in nuxt, but in my case I explicitly want to use an additional firebase function.

Additional context

This is what I want to add as a firebase function to existing nuxt3 project: https://maxbarry.medium.com/dynamic-on-demand-image-resizing-using-firebase-hosting-and-google-cloud-functions-to-make-a-cheap-d64e8f5805d1

If I forgot to add important info to this Issue, please let me know so that I can add it.

Logs

No response