[REQUIRED] Environment info
**Platform: Windows wsl (Ubuntu)
i have followed the exact steps in
https://firebase.google.com/docs/functions/get-started?gen=2nd&hl=ko#about_this_tutorial
but it occurs
"Failed to load function definition from source: FirebaseError: User code failed to load. Cannot determine backend specification "
when i run "firebase emulators:start" command
[Error Report]
When I run 'firebase emulators:start'
`i emulators: Starting emulators: functions, firestore
⚠ functions: The following emulators are not running, calls to these services from the Functions emulator will affect production: auth, database, hosting, pubsub, storage
i firestore: Firestore Emulator logging to firestore-debug.log
✔ firestore: Firestore Emulator UI websocket is running on 9150.
i ui: Emulator UI logging to ui-debug.log
i functions: Watching "/mnt/c/Users/sunwu/Downloads/Tryagain/pythontry/functions" for Cloud Functions...
✔ functions: Using node@18 from host.
⬢ functions: Failed to load function definition from source: FirebaseError: User code failed to load. Cannot determine backend specification
┌─────────────────────────────────────────────────────────────┐ │ ✔ All emulators ready! It is now safe to connect your app. │ │ i View Emulator UI at http://127.0.0.1:4000/ │ └─────────────────────────────────────────────────────────────┘
┌───────────┬────────────────┬─────────────────────────────────┐ │ Emulator │ Host:Port │ View in Emulator UI │ ├───────────┼────────────────┼─────────────────────────────────┤ │ Functions │ 127.0.0.1:5001 │ http://127.0.0.1:4000/functions │ ├───────────┼────────────────┼─────────────────────────────────┤ │ Firestore │ 127.0.0.1:8080 │ http://127.0.0.1:4000/firestore │ └───────────┴────────────────┴─────────────────────────────────┘
Emulator Hub running at 127.0.0.1:4400
Other reserved ports: 4500, 9150
in --debug
[2023-05-24T00:10:58.203Z] Building nodejs source
[2023-05-24T00:10:58.204Z] Failed to find version of module node: reached end of search path
/mnt/c/Users/sunwu/Downloads/Tryagain/pythontry/functions/node_modules
✔ functions: Using node@18 from host.
[2023-05-24T00:10:58.215Z] Could not find functions.yaml. Must use http discovery
[2023-05-24T00:10:58.240Z] Found firebase-functions binary at
'/mnt/c/Users/sunwu/Downloads/Tryagain/pythontry/functions/node_modules/.bin/firebase-functions'
[2023-05-24T00:11:02.712Z] Serving at port 8528
[2023-05-24T00:11:16.857Z] shutdown requested via /__/quitquitquit
⬢ functions: Failed to load function definition from source: FirebaseError: User code failed to load. Cannot determine backend specification {"metadata":{"emulator":{"name":"functions"},"message":"Failed to load function definition from source: FirebaseError: User code failed to load. Cannot determine backend specification"}}
it is just a simple project so i have no idea why its not working..
Got the same error
Error: User code failed to load. Cannot determine backend specification.
Turns out that when I initialized a new project using firebase init the default nodejs version it uses is 18.
Just needed to change my version in package.json file to the current installed on my system. For me it was 16.
"engines": { "node": "16" },


This error will happen if you upgrade firebase-functions, without upgrading your tooling.
In order to fix it, just run npm i -g firebase-tools
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With