Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Firebase Functions Shell does not reflect the port number set by specifying the port from the command line. #5521

Closed
yukisakai1225 opened this issue Feb 15, 2023 · 2 comments · Fixed by #5531

Comments

@yukisakai1225
Copy link

[REQUIRED] Environment info

firebase-tools:11.18.0

Platform:macOS

[REQUIRED] Test case

  1. Implement am appropriate function.
  2. Start an emulator in shell as follows.
firebase functions:shell --port 5001
  1. Even though port 5001 is specified, it is started on port 5000.

[REQUIRED] Steps to reproduce

  1. mkdir test && cd test
  2. firebase init > functions > any existing project > typescript
  3. Enable helloWorld in index.ts
  4. cd functions && npm run build && firebase functions:shell --port 5001

[REQUIRED] Expected behavior

Starts an emulator on port 5001.

[REQUIRED] Actual behavior

[2023-02-15T06:14:49.355Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[2023-02-15T06:14:49.357Z] > authorizing via signed-in user (sakai.yuki@letterfan.jp)
[2023-02-15T06:14:49.358Z] [iam] checking project tokyo-epoch-314712 for permissions ["firebase.projects.get"]
[2023-02-15T06:14:49.360Z] >>> [apiv2][query] POST https://cloudresourcemanager.googleapis.com/v1/projects/tokyo-epoch-314712:testIamPermissions [none]
[2023-02-15T06:14:49.360Z] >>> [apiv2][(partial)header] POST https://cloudresourcemanager.googleapis.com/v1/projects/tokyo-epoch-314712:testIamPermissions x-goog-quota-user=projects/tokyo-epoch-314712
[2023-02-15T06:14:49.360Z] >>> [apiv2][body] POST https://cloudresourcemanager.googleapis.com/v1/projects/tokyo-epoch-314712:testIamPermissions {"permissions":["firebase.projects.get"]}
[2023-02-15T06:14:50.036Z] <<< [apiv2][status] POST https://cloudresourcemanager.googleapis.com/v1/projects/tokyo-epoch-314712:testIamPermissions 200
[2023-02-15T06:14:50.036Z] <<< [apiv2][body] POST https://cloudresourcemanager.googleapis.com/v1/projects/tokyo-epoch-314712:testIamPermissions {"permissions":["firebase.projects.get"]}
[2023-02-15T06:14:50.349Z] [functions] Functions Emulator only supports listening on one address (127.0.0.1). Not listening on ::1
[2023-02-15T06:14:50.359Z] [functions] Using node@16 from host.
[2023-02-15T06:14:50.362Z] defaultcredentials: writing to file /Users/sakaiyuuki/.config/firebase/sakai_yuki_letterfan.jp_application_default_credentials.json
[2023-02-15T06:14:50.364Z] DEBUG: Setting GAC to /Users/sakaiyuuki/.config/firebase/sakai_yuki_letterfan.jp_application_default_credentials.json
[2023-02-15T06:14:50.365Z] >>> [apiv2][query] GET https://firebase.googleapis.com/v1beta1/projects/tokyo-epoch-314712/adminSdkConfig [none]
[2023-02-15T06:14:50.758Z] <<< [apiv2][status] GET https://firebase.googleapis.com/v1beta1/projects/tokyo-epoch-314712/adminSdkConfig 200
[2023-02-15T06:14:50.759Z] <<< [apiv2][body] GET https://firebase.googleapis.com/v1beta1/projects/tokyo-epoch-314712/adminSdkConfig {"projectId":"tokyo-epoch-314712","storageBucket":"tokyo-epoch-314712.appspot.com","locationId":"asia-northeast1"}
[2023-02-15T06:14:50.804Z] [functions] Watching "/Users/sakaiyuuki/Desktop/tmp/functions" for Cloud Functions...
[2023-02-15T06:14:50.817Z] 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.
⚠  functions: Please note that there will be breaking changes when you upgrade.
[2023-02-15T06:14:52.110Z] > [functions] package.json contents: {
  "name": "functions",
  "scripts": {
    "build": "tsc",
    "build:watch": "tsc --watch",
    "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",
  "dependencies": {
    "firebase-admin": "^10.2.0",
    "firebase-functions": "^3.21.0"
  },
  "devDependencies": {
    "typescript": "^4.6.4"
  },
  "private": true
}
[2023-02-15T06:14:52.111Z] Building nodejs source
[2023-02-15T06:14:52.111Z] Analyzing nodejs backend spec
[2023-02-15T06:14:52.117Z] Could not find functions.yaml. Must use http discovery
[2023-02-15T06:14:52.333Z] Serving at port 9011

[2023-02-15T06:14:52.415Z] Got response from /__/functions.yaml {"endpoints":{"helloWorld":{"platform":"gcfv1","httpsTrigger":{},"entryPoint":"helloWorld"}},"specVersion":"v1alpha1","requiredAPIs":[]}
[2023-02-15T06:14:52.436Z] shutdown requested via /__/quitquitquit

[2023-02-15T06:14:52.447Z] [functions] Loaded functions definitions from source: helloWorld.
[2023-02-15T06:14:52.449Z] [functions[us-central1-helloWorld]] http function initialized (http://127.0.0.1:5000/tokyo-epoch-314712/us-central1/helloWorld).
i  functions: Loaded functions: helloWorld
⚠  functions: The following emulators are not running, calls to these services will affect production: firestore, database, pubsub, storage, eventarc
@aalej
Copy link
Contributor

aalej commented Feb 17, 2023

Hi @yukisakai1225, thanks for providing a detailed description of the issue. Using the steps you provided, I was able to reproduce the issue when using firebase-tools v11.23.1. I’ll relay this to the team so that they can take a look into it. That said, I'll be marking this as reproducible.

@taeold
Copy link
Contributor

taeold commented Feb 18, 2023

@yukisakai1225 Thanks for reporting the issue!

It looks like we accidentally broke this feature some time ago (#5083) - will make sure we ship a fix in the next release. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants