I'm trying to add listeners in my cloud functions to a second database instance according to the documentation here using:
exports.myHandler = functions.database.instance('foo').ref('bar')...
I am getting an error that the functions.database.instance() function doesn't exist. I have updated my functions using npm upgrade and firebase-functions specifically using npm install --save firebase-functions. I still don't see any reference to InstanceBuilder or functions.database.instance() in the source code. Has this functionality actually been released? Am I missing something?
I updated the dependencies in package.json to use the latest versions of firebase-admin and firebase-functions, and it's fixed.
Related
I'm trying to update to the most recent versions of firebase-admin (11.0.0) and firebase-functions (3.21.2). I'm using firebase-tools 11.1.0. I get this error when try to deploy my functions:
Error: Failed to load function definition from source: Failed to generate manifest from function source: Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './lib' is not defined by "exports" in /Users/myuser/Documents/myproject/node_modules/firebase-functions/package.json
I've seen similar errors in StackOverflow like this one or this one but this error is slightly different. The problem is not in firebase or firebase-admin dependencies but with firebase-functions.
Using firebase-functions 3.14.1 works (I get some warnings though) but I'd like to update to the latest version so I can hopefully get rid of warnings and get the latest updates.
How can I fix this?
Thanks!
As the error described, the problem was that I had imports referencing the lib folder of firebase-functions like this:
import { HttpsError } from 'firebase-functions/lib/providers/https'
...
throw new HttpsError('failed-precondition', 'An error')
The problem was gone after removing all of them and replacing with something like the following:
import { https } from 'firebase-functions'
...
throw new https.HttpsError('failed-precondition', 'An error')
The first approach worked until 3.14.1. Above that, it looks like we can't reference the lib folder in the from. Not ideal because I wanted to avoid the namespace when using these types, but at least it works.
In the documentation, we can find a warning to constantly update the firebase-functions sdk. The warning is:
In many cases, new features and bug fixes are available only with the
latest version of the Firebase CLI and the firebase-functions SDK.
It's a good practice to frequently update both the Firebase CLI and
the SDK with these commands inside the functions folder of your
Firebase project:
npm install firebase-functions#latest firebase-admin#latest --save npm
install -g firebase-tools
These could be the main causes for this error message. As you haven't provided any code.
Additonally, it might be conflicting with the firebase-admin 11.0 version. This GitHub issue claims firebase-admin 11.0 does not support firebase-functions version 3.21.2. But it succeeds with firebase-admin 10.0 and firebase-functions version 3.21.2.
I’d suggest using firebase-admin 10.0 and firebase-functions version 3.21.2.
I'm using Expo v42.0.1 and trying to install Firebase v9.0.2 and am unable to do so.
Issue
From running expo install firebase, firebase version 8.2.3 is installed. When changing the package.json to use firebase version 9.0.2, I get an error when running the app:
"firebase" is added as a dependency in your project's package.json but it doesn't seem to be installed. Please run "yarn" or "npm install" to fix this issue.
What I've tried
Running yarn / npm install
Running expo install firebase#9.0.2 (which ends up just downloading 8.2.3)
Has anyone seen this before or know why it is happening? I believe it is because Expo v42 is not yet compatible with the modular version of firebase (v9).
You are correct.
Has anyone seen this before or know why it is happening? I believe it is because Expo v42 is not yet compatible with the modular version of firebase (v9).
But you can make it work with using it like this in you package.json:
"#firebase": "^9.0.2",
Discussion about this: "firebase" is added as a dependency in your project's package.json but it doesn't seem to be installed
I have used this solution in 2 projects. 1 works perfectly but in another I faced issued where version firebase#9.0.0-beta.7 works perfectly but in version firebase#9.0.2 everything but Firestore works
More about it here: Expo + firebase#9.0.1/9.0.0: #firebase/firestore:, Firestore (9.0.0): Could not reach Cloud Firestore backend
I am trying to update my Firebase CLI installation, in order to use the cloud functions for my project. I followed the getting-started guide, however for some reason, the CLI cannot detect the updated version.
I initialized a project of mine that I have already created via the Firebase console. During the project initialization, Firebase CLI mentioned that my CLI version should be updated, however the complete procedure went smoothly.
Once the initialization completed, I run for the first time (to update the CLI):
npm install -g firebase-tools
Once the updated finished, the command line reported:
firebase-tools#3.18.6
But when I run
firebase init functions
I get:
Error: CLI is out of date (on 3.0.1 , need at least 3.0.5)
I don't understand why this is happening, since the update reported that version 3.18.6 got installed Any hints would be great!
For reference, you can see a snapshot of the command line here.
It looks like you may have multiple versions of node installed in different locations. First, uninstall all versions of node that you may have previously installed. Make sure running node on the command line doesn't execute anything. Then, reinstall everything. After you've installed the Firebase CLI again, check its version with firebase --version.
With 1.2.*, I used to build my staging/production bundles with meteor build, then moving into ./bundle/programs/server and npm install there.
I do the same thing with 1.3 version but now I have error message on trying to run bundle main file with node:
WARNING: npm peer requirements not installed:
- react#0.14.x not installed.
- react-addons-pure-render-mixin#0.14.x not installed.
Read more about installing npm peer dependencies:
http://guide.meteor.com/using-packages.html#peer-npm-dependencies
/var/www/builds/1459320997/bundle/programs/server/node_modules/fibers/future.js:267
throw(ex);
^
Error: Can't find npm module 'react'. Did you forget to call 'Npm.depends' in package.js within the 'modules-runtime' package?
I use react-meteor-data meteor package.
However, I already have "react": "^0.14.8", and "react-addons-linked-state-mixin": "^0.14.8", in my package.json and of course installed it with npm install ... --save and it is working fine on development environment when I use meteor command.
Any additional actions needed to run it? Did they change how meteor package should be build for production and didn't changed their docs? (because I don't see any changes in docs concerning meteor build so far.
Update: I tried to manually npm install these packages into ./bundle/program/server. Now they consequentially requires packages already listed in my package.json. I suppose Meteor just ignore this file on bundle. Will try to add a bug in their tracker.
I used Meteor 1.2 to build new 1.3 code so it is the issue. It happened because currently I build on the server that had another Meteor version.
I used answer from another Stackoverflow user (Ian) Updating all Meteor packages to latest versions
Easiest way is to delete the contents of .meteor/versions and then save
Meteor example app, microscope has version 0.9.4, when I try use meteor run command to launch application .
There have a print:
Sorry, this project uses Meteor METEOR#0.9.4, which is not installed and
could not be downloaded. Please check to make sure that you are online.
I am behind a proxy in corporate.
When I install the Meteor, only latest 1.0.0 can be installed.
How can I do?
Upgrade the app to 1.0.0, and how?
Downgrade the meteor to 0.9.4, and how?
I tried use meteor update --release 0.9.4, not work or using meteor update, other error pop up:
/home/hunter/.meteor/packages/meteor-tool/.1.0.35.hgbesu++os.linux.x86_32+web.browser+web.cordova/meteor-tool-os.linux.x86_32/dev_bundle/lib/node_modules/fibers/future.js:206
throw(ex);
..
Error: tunneling socket could not be established, cause=socket hang up
at Object.Future.wait (/home/hunter/.meteor/packages/meteor-tool/.1.0.35.hgbesu++os.linux.x86_32+web.browser+web.cordova/meteor-tool-os.linux.x86_32/dev_bundle/lib/node_modules/fibers/future.js:326:15)
at _.extend._createSocket (packages/ddp/stream_client_nodejs.js:265)
at _.extend._launchConnection (packages/ddp/stream_client_nodejs.js:142)
at new LivedataTest.ClientStream (packages/ddp/stream_client_nodejs.js:28)
at new Connection (packages/ddp/livedata_connection.js:52)
at Object.DDP.connect (packages/ddp/livedata_connection.js:1581)
This should proxy issue.
No document there after search.
I was able to successfully update a project from 0.9.3.1 to 1.1 with:
meteor update
Using meteor run like this:
meteor run --release
…won’t upgrade your meteor installation, but will download the --release and run the current app with it.
I had similar issue after updating meteor to 1.4.1. I happened to fix it with this help Github Issue
Reset your app
meteor reset
Install npm with meteor again
meteor npm install
Rebuild npm (Optional)
meteor npm rebuild
This is a bit late and slightly different: I have a similar problem when I upgraded from 1.0.3.1 to 1.0.3.2. After reading the answers here, and here, I tried the following which worked for me:
meteor update --release <new version>
replacing <new version> with the latest version you're running. This updated my project, and subsequent runs using meteor works as expected.
I was to update by change the file .meteor/release to meteor 1.0. I had packages issues, I also noticed that iron router inner actions changed (I fixed this by fixing the files load order) and on Meteor 1.0 you’ve a package for everything.
Try to add the package meteor-platform, it’s a meta package that contains the most used packages.
I also had issue with some atmosphere packages, it’s a tough job to upgrade it.