posva / nuxt--vuefire-example-blaze-plan

🔥 Nuxt + VueFire template to bootstrap your Firebase App with the Blaze plan
19 stars 4 forks source link

FirebaseError: could not deploy functions because the ".output/server" directory was not found #7

Open BenJackGill opened 1 month ago

BenJackGill commented 1 month ago

1) Download blaze plan template 2) npm i to install 3) In seperate Terminal sessions run npm run emulators and npm run dev 4) Check emulator function logs

You will see this:

functions - Watching "/Users/BenJackGill/Dev/nuxt--vuefire-example-blaze-plan/.output/server" for Cloud Functions...
functions - Failed to load function definition from source: FirebaseError: could not deploy functions because the ".output/server" directory was not found. Please create it or specify a different source directory in firebase.json

The problem is that .output/server does not exist.

I took a guess that the path might be .nuxt/dev/server so I changed firebase.json to this and restarted emulators and dev server:

  "functions": [
    {
      "source": ".nuxt/dev/server",
      "codebase": "default",
      "ignore": [".git", "firebase-debug.log", "firebase-debug.*.log"]
    }
  ]

But that produced this error

functions - Watching "/Users/BenJackGill/Dev/nuxt--vuefire-example-blaze-plan/.nuxt/dist/server" for Cloud Functions...
functions - Failed to load function definition from source: FirebaseError: Could not detect runtime for functions at /Users/BenJackGill/Dev/nuxt--vuefire-example-blaze-plan/.nuxt/dist/server
BenJackGill commented 1 month ago

Ok I just realised we also need to run npm run build to build the outputs (including ./outputs/server) before can run locally with the emulators. Maybe the docs need updating because under the "Trying this out locally" heading that was not clear.