firebase / firebase-tools

The Firebase Command Line Tools
MIT License
4.02k stars 935 forks source link

Firebase functions emulator doesn't work after firebase-functions 3.20.0 or higher (Docker) #4976

Open irux opened 2 years ago

irux commented 2 years ago

[REQUIRED] Environment info

firebase-tools: 11.9.0 firebase-functions: above 3.20.0. It works with 3.18.1 or before.

Dockerfile: https://github.com/AndreySenov/firebase-tools-docker/blob/main/Dockerfile.node16

Using Docker Desktop on Windows.

[REQUIRED] Steps to reproduce

services:
  firebase:
    build:
      context: .
      dockerfile: Dockerfile.emulators
      args:
        VERSION: "latest"
    volumes:
      - ./:/home/node
    ports:
      - 4000:4000
      - 9099:9099
      - 8080:8080
      - 9199:9199
      - 9005:9005
    command: firebase emulators:start

this docker-compose file with the dockerfile above.

[REQUIRED] Expected behavior

Functions should be loaded. This only happens when I use a package of firebase-functions higher or equal than 3.20.0

Locally, in my windows machine, works as expected.

[REQUIRED] Actual behavior

[2022-09-13T20:54:29.248Z] Web / API server started at 0.0.0.0:4000
 {"metadata":{"emulator":{"name":"ui"},"message":"Web / API server started at 0.0.0.0:4000\n"}}
i  functions: Watching "/home/node/functions" for Cloud Functions... {"metadata":{"emulator":{"name":"functions"},"message":"Watching \"/home/node/functions\" for Cloud Functions..."}}
[2022-09-13T20:54:29.531Z] Validating nodejs source
⚠  functions: package.json indicates an outdated version of firebase-functions. Please upgrade using npm install --save firebase-functions@latest in your functions directory.
[2022-09-13T20:54:58.634Z] > [functions] package.json contents: {
  "name": "package",
  "scripts": {
    "lint": "eslint --ext .js,.ts .",
    "build": "tsc",
    "test": "jest",
    "serve": "npm run build && firebase emulators:start --only functions",
    "shell": "npm run build && firebase functions:shell",
    "start": "npm run shell",
    "deploy": "firebase deploy --only functions",
    "logs": "firebase functions:log"
  },
  "engines": {
    "node": "16"
  },
  "main": "lib/index.js",
  "types": "lib/index.d.ts",
  "dependencies": {
    "@firebase/firestore-types": "2.5.0",
    "@company/contracts": "0.0.3",
    "@company/templating": "^0.0.6-dev.20220908154703",
    "@company/types": "^0.1.8-dev.20220911174347",
    "@metamask/eth-sig-util": "^4.0.0",
    "@nowpaymentsio/nowpayments-api-js": "^1.0.5",
    "@sendgrid/mail": "^7.6.0",
    "@sentry/cli": "^1.72.0",
    "@sentry/node": "^6.16.1",
    "@types/express": "^4.17.13",
    "@types/supertest": "^2.0.12",
    "aws-sdk": "^2.1066.0",
    "axios": "^0.24.0",
    "body-parser": "^1.19.0",
    "builder-pattern": "^1.3.0",
    "caniuse-lite": "^1.0.30001380",
    "cors": "^2.8.5",
    "dayjs": "^1.11.5",
    "ejs": "^3.1.6",
    "ethers": "5.5.2",
    "express": "^4.17.1",
    "firebase-admin": "^9.8.0",
    "firebase-functions": "^3.20.0",
    "inversify": "^6.0.1",
    "inversify-express-utils": "^6.4.3",
    "moralis": "0.0.176",
    "nanoid": "^3.2.0",
    "puppeteer": "^13.0.1",
    "reflect-metadata": "^0.1.13",
    "uuid": "^8.3.2"
  },
  "devDependencies": {
    "@babel/core": "^7.16.7",
    "@babel/preset-env": "^7.16.7",
    "@babel/preset-typescript": "^7.16.7",
    "@trendyol/jest-testcontainers": "^2.1.1",
    "@types/jest": "^27.5.1",
    "@types/node": "^14.18.3",
    "@types/puppeteer": "^5.4.4",
    "@types/uuid": "^8.3.4",
    "@typescript-eslint/eslint-plugin": "^3.9.1",
    "@typescript-eslint/parser": "^3.8.0",
    "babel-jest": "^28.0.0",
    "eslint": "^7.6.0",
    "eslint-config-google": "^0.14.0",
    "eslint-plugin-import": "^2.22.0",
    "firebase": "^9.9.3",
    "firebase-functions-test": "^0.2.0",
    "jest": "^28.0.0",
    "jest-mock-extended": "^2.0.7",
    "supertest": "^6.2.4",
    "ts-jest": "^28.0.8",
    "typescript": "^4.5.4"
  },
  "private": true
}
[2022-09-13T20:54:58.643Z] Building nodejs source
[2022-09-13T20:54:58.643Z] Analyzing nodejs backend spec
[2022-09-13T20:54:58.679Z] Could not find functions.yaml. Must use http discovery
[2022-09-13T20:55:15.836Z] Serving at port 9005

[2022-09-13T20:56:03.169Z] shutdown requested via /__/quitquitquit
google-oss-bot commented 2 years ago

This issue does not seem to follow the issue template. Make sure you provide all the required information.

colerogers commented 2 years ago

@irux Thanks for opening this issue, sorry you're running into it. Unfortunately, I don't have a windows machine to test this out. I'll ask around internally for help replicating this issue and will respond back with next steps. Thanks!