FirebaseError: User code failed to load. Cannot determine backend specification

12,024 views
Skip to first unread message

Jenifer Akinyemi

unread,
Feb 19, 2023, 7:55:46 PM2/19/23
to Firebase Google Group
Hi, this is my first firebase project, each time I enter the 'firebase emulators: start' command I always get this error 'FirebaseError: User code failed to load. Cannot determine backend specification'Screenshot (147).png

Wilhelm Mauch

unread,
Apr 18, 2023, 11:38:37 PM4/18/23
to Firebase Google Group
Hi Jenifer,

add the engines key to your packages.json


  "engines": {
    "node": ">=18.0.0"
  }
}

Victor Dan-Jumbo

unread,
Apr 30, 2023, 10:26:52 AM4/30/23
to Firebase Google Group
Hi, I am combining Cloud Function with NestJS.
Just did the above and got another error message

Failed to
generate manifest from function source: Error: Cannot find module 'src/module'


image_61.png

Jeff Huleatt

unread,
May 5, 2023, 10:51:53 AM5/5/23
to Firebase Google Group
Hi Jenifer and Victor,

Jenifer: "User code failed to load. Cannot determine backend specification" is a pretty broad error that logs whenever the Firebase CLI has trouble parsing function code. Try using the debug flag (`firebase emulators:start --debug`) to get additional output that may help track down the issue. Specifically, check for any warnings or errors that happen before the "Cannot determine backend specification" error - that should give you the clues you need to get this fixed!

Victor: I see that you're importing `IndexModule` from `src/module` on line 6 - is there a chance that a file is missing there or is missing an export? Also, remember to run the TypeScript compiler and make sure that the `main` field in your 'package.json' file points to the compiled JS output. Hopefully it's a simple fix!

As a general reminder to both of you, it's always a good idea to make sure you're using the latest version of firebase-functions (npm i --save firebase-functions@latest) and the Firebase CLI (npm i -g firebase-tools@latest). Sometimes this will fix things on its own.

Best,
Jeff

Victor Dan-Jumbo

unread,
May 5, 2023, 7:37:07 PM5/5/23
to Firebase Google Group

Basically you have to keep restarting the emulator till it finally launches. as Funny as it sound thats the only hack that has worked for me so far.

You can set the Node Engine as 10, 14, 18 or >=18.0.0 on the package.json any works.

Victor Dan-Jumbo

unread,
May 5, 2023, 7:37:07 PM5/5/23
to Firebase Google Group
Nevermind. My issue was caused by a TS Import issue.

Victor Dan-Jumbo

unread,
May 7, 2023, 5:48:30 PM5/7/23
to Firebase Google Group
Thank you @Jeff
I've discovered and resolved the import issue already. Thanks anyway.
And thank you for the --debug flag this would save me a lot of time figuring out what went wrong.
Reply all
Reply to author
Forward
0 new messages