-
Notifications
You must be signed in to change notification settings - Fork 218
Description
I am using the workspaces (monorepo) feature of yarn. My functions directory is a subrepo. That subrepo lists firebase-admin and firebase-functions as dependencies, but when installing packages, yarn "hoists" them, so they come under node_modules at the top of the repo hierarchy:
my-repo
functions
package.json, with firebase-functions etc. as dependencies
node_modules
firebase-functions << yarn hoists this package here
The problem is, when I try to deploy the cloud functions, I get the message
Error: Error parsing triggers: Cannot find module 'firebase-admin'
What is apparently happening is that the deployment logic is parsing the code, and looking for firebase-admin directly inside the functions/node_modules directory, and not looking up the node search path as one might expect.
The only alternative I can see is to run npm install directly inside the functions directory, but that sort of defeats the purpose of having a mono-repo in the first place. Also, I have to redo that every time I run yarn on my monorepo since yarn would think the "local" versions of the packages under functions are unnecessary and would hoist them again. I could remove the functions directory from the list of workspaces, but that would lead to problems linking to other sub-repos.
Assuming I am understanding the problem correctly, what I would like to see as desired behavior is to have the Firebase functions parsing logic search for packages up the node search chain, rather than limiting its search to function/node_modules.
I did try adding symbolic links from functions/node_modules to $TOP/modules. But that fails too, when the Firebase functions parsing logic tries finding dependencies called in by firebase-functions etc.
Version info
firebase-functions: 0.8.1
firebase-tools: 3.14.0
firebase-admin: 5.8.1