I have an old Meteor application that is no longer developed/supported, it has a number of users. I have a new app to replace it.
In my new Express app, I have a login handler that can accept a username+password.
How can I make calls like Meteor.loginWithPassword(username, password, callback) when I am not actually in a meteor app. There are many references in the docs to the accounts-password package, but this is not an npm package in itself.
How can I install the required packages outside the meteor CLI? I'm just in a regular npm express app.
Related
I keep getting the error below:
? Are you ready to proceed? Yes
? Which Firebase features do you want to set up for this directory? Press Space to select features, then Enter to confirm your choices. Hosting: Configure files for Firebase Hosting and (optionally) set up GitHub Action deploys
=== Project Setup
First, let's associate this project directory with a Firebase project.
You can create multiple project aliases by running firebase use --add,
but for now we'll just set up a default project.
? Please select an option: Use an existing project
Error: Failed to list Firebase projects. See firebase-debug.log for more info.
PS C:\Users\xxxxxlinked-in>
I have tried everything I can find on StackOverflow:
firebase login will log me in.
I have also done the firebase login --reauth one and also just reinstalling it npm install -g firebase-tools.
Its just when I go to use an existing project.
If it helps to know, I keep gettin another error when uing this command firebase projects:list.
I'm trying to write tests for my Firebase Cloud Functions, specifically the HTTPS ones. The app uses a permissions system in which each signed-up user of the app has their own entry in Firestore storing the list of permissions they have, indexed by their uid. When these functions are called from the client, the function checks context.auth to determine if the user is authenticated, then uses context.auth.uid to find the entry for the user in Firestore and determine if they have permissions to run this function.
I am now trying to write tests for these functions using the online mode, as recommended in Google's documentation. However, there does not seem to be a way (at least in this mode) to control the context.auth.uid or mock it for the test. As a result, it seems like it might be impossible to tests these functions in this mode.
Is there any way to do this I'm missing, or some workaround?
You may use the signInAnonymously method this can create and use temporary anonymous accounts to authenticate with Firebase anonymously. According to Firebase Test SDK online mode means that other Google SDKs used in your function will work as well. Install both firebase-functions-test and Mocha, a testing framework, by running the following commands in your functions folder:
npm install --save-dev firebase-functions-test
npm install --save-dev mocha
Make sure to follow test setup and used the Authenticate with Firebase Anonymously.
My app gets the username and password from the client, then uses them to log in to another site on the web and if successful, the app runs Accounts.createUser({useranme and password});
I do not use the ui provided by accounts-ui.
Do I need to leave accounts-ui and accounts-password installed? Are they required for some behind-the-scene magic? or Meteor stock Accounts package(s) is enough?
If I remove them, will I still be able to serve each client his/her own created documents? Sorry, I am very new to Meteor.
Thanks
There are several questions in here, so I'll inline the answers.
Do I need to leave accounts-ui installed?
No. You mentioned you have your own UI for account management.
Do I need to leave accounts-password installed?
Yes. accounts-password provides you with Accounts.createUser which you mentioned you are using.
If I remove them, will I still be able to serve each client his/her own created documents?
accounts-base gives you Meteor.userId(), Meteor.user(), etc. You'll need those to publish per-user documents. But again, you'll need to keep accounts-password as mentioned above.
I've got a app called packagetester with a /packages directory, and a local package called lauffenp:notifications inside of the /packages directory.
Here is the packages file from packagetester.
meteor-base # Packages every Meteor app needs to have
mobile-experience # Packages for a great mobile UX
mongo # The database Meteor supports right now
blaze-html-templates # Compile .html files into Meteor Blaze views
session # Client-side reactive dictionary for your app
jquery # Helpful client-side library
tracker # Meteor's client-side reactive programming library
standard-minifiers # JS/CSS minifiers run for production mode
es5-shim # ECMAScript 5 compatibility for older browsers.
ecmascript # Enable ECMAScript2015+ syntax in app code
autopublish # Publish all data to the clients (for prototyping)
insecure # Allow all DB writes from clients (for prototyping)
lauffenp:notifications
Now, if I run it in a single terminal using meteor, it works fine, it finds the package like it should and executes it.
However, if I open a second terminal and try to do the same thing, it can't find the package:
=> Started MongoDB.
=> Errors prevented startup:
While selecting package versions:
error: unknown package in top-level dependencies: lauffenp:notifications
Here is a screen capture of the app running on the left terminal and failing on the right terminal.
screen capture of app running/not running in two terminal instances
If I exit the left terminal, it won't run and gives me the same error. I have to meteor remove and meteor add to somehow 'reset' packages and then I can run it on one terminal.
How can I get meteor to 'persist' a local package?
The error you get on the second terminal seems to be related to missing packages, but in fact it is due to the fact that you are trying to run multiple instances of the same application within the same directory.
You cannot do that.
While one instance tries to build the app into the .meteor/local directory the other races to clean and rebuild and one of the instances lose track of dependencies, hence the misleading error message.
But if you check the previous warning on the other terminal, you'll see that the actual problem is multiple instances.
Namely,
if there is something else listening on 3000, you must run meteor on another port
if you want to run two instances of the same app, you must create another copy of your app folder, run the second instance from that copied folder and set it to listen on another port
I want to use Meteor packages (like minimongo) outside the main Meteor app. Furthermore, I would like to connect to the MongoDB database of running Meteor app. So that I can have a background worker and similar things which should read/write to the app database. I would like to use minimongo to be really compatible with Meteor (like having same IDs). And I would like to be able to connect to app database also in development.