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

Functions emulator not working after upgrade to 10.2.2 when using Yarn PnP #4275

Closed
ericvera opened this issue Mar 9, 2022 · 3 comments
Closed
Assignees

Comments

@ericvera
Copy link
Contributor

ericvera commented Mar 9, 2022

[REQUIRED] Environment info

firebase-tools: 10.2.2

Platform: macOS

[REQUIRED] Test case

  • The repro below works perfectly with 10.1.5.
  • In the case of 10.2.2 it only works if I run the command outside or the package.json script (directly on console).
  • Running a package.json script that does not include the functions emulator (only auth and Firestore) still works.
  • My guess is that something changed between 10.1.5 and 10.2.2 that is trying to load the node project in process or something similar that now goes through Yarn. Some logging on what the error is would be helpful to troubleshoot.

[REQUIRED] Steps to reproduce

  1. Create a project that uses yarn pnp
  2. Add a script to package.json such as
    "emulate": "firebase --project=test-project emulators:start --only auth,functions,firestore --import .firebase-emulator --export-on-exit",
  3. Run the script yarn emulate

[REQUIRED] Expected behavior

Emulator runs

[REQUIRED] Actual behavior

Emulator fails showing the following in the console:

eric@Erics-MacBook-Air project-name % yarn emulate
i  emulators: Starting emulators: auth, functions, firestore
⚠  functions: The following emulators are not running, calls to these services from the Functions emulator will affect production: database, hosting, pubsub, storage
✔  functions: Using node@16 from host.
⚠  functions: Unable to fetch project Admin SDK configuration, Admin SDK behavior in Cloud Functions emulator may be incorrect.
i  firestore: Importing data from /Users/eric/Code/project-name/.firebase-emulator/firestore_export/firestore_export.overall_export_metadata
i  firestore: Firestore Emulator logging to firestore-debug.log
i  auth: Importing config from /Users/eric/Code/project-name/.firebase-emulator/auth_export/config.json
i  auth: Importing accounts from /Users/eric/Code/project-name/.firebase-emulator/auth_export/accounts.json
i  ui: Emulator UI logging to ui-debug.log
i  functions: Watching "/Users/eric/Code/project-name/functions/out" for Cloud Functions...
i  emulators: Shutting down emulators.
i  ui: Stopping Emulator UI
⚠  Emulator UI has exited upon receiving signal: SIGINT
i  functions: Stopping Functions Emulator
i  firestore: Stopping Firestore Emulator
i  auth: Stopping Authentication Emulator
i  hub: Stopping emulator hub
i  logging: Stopping Logging Emulator

Error: There was an unknown problem while trying to parse function triggers.

Logs show

...
[debug] [2022-03-09T14:33:08.736Z] Web / API server started at localhost:4000
 {"metadata":{"emulator":{"name":"ui"},"message":"Web / API server started at localhost:4000\n"}}
[info] i  functions: Watching "/Users/eric/Code/project-name/functions/out" for Cloud Functions... {"metadata":{"emulator":{"name":"functions"},"message":"Watching \"/Users/eric/Code/project-name/functions/out\" for Cloud Functions..."}}
[debug] [2022-03-09T14:33:08.825Z] Validating nodejs source
[debug] [2022-03-09T14:33:09.707Z] > [functions] package.json contents: {
  "name": "@project-name/functions",
  "version": "1.0.10",
  "main": "./index.js",
  "scripts": {
    "start": "yarn run shell"
  },
  "engines": {
    "node": "16"
  },
  "dependencies": {
    "@google-cloud/firestore": "^5.0.2",
    "firebase-admin": "^10.0.2",
    "firebase-functions": "3.18.1"
  }
}
[debug] [2022-03-09T14:33:09.707Z] Building nodejs source
[debug] [2022-03-09T14:33:09.707Z] Analyzing nodejs backend spec
[info] i  emulators: Shutting down emulators. {"metadata":{"emulator":{"name":"hub"},"message":"Shutting down emulators."}}
[info] i  ui: Stopping Emulator UI {"metadata":{"emulator":{"name":"ui"},"message":"Stopping Emulator UI"}}
[warn] ⚠  Emulator UI has exited upon receiving signal: SIGINT 
[info] i  functions: Stopping Functions Emulator {"metadata":{"emulator":{"name":"functions"},"message":"Stopping Functions Emulator"}}
[info] i  firestore: Stopping Firestore Emulator {"metadata":{"emulator":{"name":"firestore"},"message":"Stopping Firestore Emulator"}}
[debug] [2022-03-09T14:33:09.750Z] *** shutting down gRPC server since JVM is shutting down
 {"metadata":{"emulator":{"name":"firestore"},"message":"*** shutting down gRPC server since JVM is shutting down\n"}}
[debug] [2022-03-09T14:33:09.753Z] *** server shut down
 {"metadata":{"emulator":{"name":"firestore"},"message":"*** server shut down\n"}}
[info] i  auth: Stopping Authentication Emulator {"metadata":{"emulator":{"name":"auth"},"message":"Stopping Authentication Emulator"}}
[info] i  hub: Stopping emulator hub {"metadata":{"emulator":{"name":"hub"},"message":"Stopping emulator hub"}}
[info] i  logging: Stopping Logging Emulator {"metadata":{"emulator":{"name":"logging"},"message":"Stopping Logging Emulator"}}
[error] 
[error] Error: There was an unknown problem while trying to parse function triggers.

@ericvera ericvera added the bug label Mar 9, 2022
@taeold taeold self-assigned this Mar 10, 2022
@taeold
Copy link
Contributor

taeold commented Mar 14, 2022

@ericvera Thank you for detailed report!

I also don't have immediate bunch on what might be going wrong. I'm going to try to push out a change to make error messages more useful to help us debug the issue. In the meantime, can you help us by sharing a small sample that can reproduce the issue? I've never used that setup, and while we don't officially support yarn pnp, it seems like it's always worked before.

@taeold taeold added the Needs: Author Feedback Issues awaiting author feedback label Mar 14, 2022
@google-oss-bot
Copy link
Contributor

Hey @ericvera. We need more information to resolve this issue but there hasn't been an update in 7 weekdays. I'm marking the issue as stale and if there are no new updates in the next 3 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

@google-oss-bot
Copy link
Contributor

Since there haven't been any recent updates here, I am going to close this issue.

@ericvera if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this.

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

No branches or pull requests

3 participants