Could not detect language for functions at functions

507

I came across this issue with a custom build process and pointing only to my dist folder.

There are three requirements for a successful build:

  1. a firebase.json with functions.source pointing to a directory containing a package.json
  2. The package.json containing a "main":"path-to-index.js" field.
  3. A node engine specified in either the package.json or firebase.json
//firebase.json
{
  "functions": {
    "source": "./some-dir"
  }
}
//some-dir/package.json
{
  "main": "lib/index.js",
  "engines": {
    "node": "16"
  }
}
Share:
507
Roman Soviak
Author by

Roman Soviak

When I was a child I played football for my village. I believe in the piece all over the world. I like to develop programs and in love with Android OS. I learn programming for myself with my friends. We stand around books, speak with each other, sing songs about life and develop programs.

Updated on January 01, 2023

Comments

  • Roman Soviak
    Roman Soviak 10 months

    After firebase deploy in flutter web I get this error: error

    In this answer person recommends firebase init, but I already have Firebase in the app. Thanks for any ideas!

    • Peter Koltai
      Peter Koltai about 2 years
      Can you add the contents of package.json from functions folder?
    • Roman Soviak
      Roman Soviak about 2 years
      { "dependencies": { "languagedetect": "^2.0.0" } } @PeterKoltai
    • Peter Koltai
      Peter Koltai about 2 years
      On Firebase Functions init, the package.json gets populated with settings like engines, dependencies for firebase-functions etc., do you have these as well?
    • Roman Soviak
      Roman Soviak about 2 years
      @PeterKoltai I fixed it by using this answer
    • Roman Soviak
      Roman Soviak about 2 years
      @PeterKoltai How can I get this info from functions from my Firebase?
    • Roman Soviak
      Roman Soviak about 2 years
      @PeterKoltai functions were written by hand and I don't use it in my flutter web app
    • Peter Koltai
      Peter Koltai about 2 years
      If you want to use Firebase Functions, then you have to initialize it with firebase init functions, which creates functions folder with necessary files.
    • Peter Koltai
      Peter Koltai about 2 years
      If you don't use, then you should not deploy functions.
    • Peter Koltai
      Peter Koltai about 2 years
      (Funny thing here: you have languagedetect package, but the error message is not about this, but because it can't detect the programming language of functions.)