I'm following the Meteor guide and have setup a login system using the following packages: useraccounts:bootstrap useraccounts:flow-routing accounts-ui@1.1.9 accounts-password@1.4.0. When I deploy my app for testing using the meteor-now command I'm able to register an account and login into my app but after a while of not using the app trying to log back in I get the login forbidden message and it seems the account I registered does not exist anymore. I cannot find a reason why this would be happening. I'm assuming it has something to do with deploying with meteor-now since I don't seem to have this issue on my local instance.
- 452
- 3
- 11
- 28
1 Answers
On localhost when you developing your application you are connected to the local database. You can set the database connection parameter in an environment variable MONGO_URL.
Whey you using meteor-now then your application is deployed. It means that code od application is compiled and installed on Meteor cloud hosting.
The code is transferred but data and configuration no. There are some solutions and you can chode one dependently from what you want to achieve.
1) Connect local instance to the production database. You should set MONGO_URL on the local machine.
Tutorials
2) You should create fixtures. I mean commands that executes when server starting and creating a user in the database if he does not exists.
In your case, I would recommend the second approach.
There is an example of creating a user by fixtures
UPDATE 1
After installing Meteor Now I see these output without any additional configuration
Paragraphs on link
https://github.com/jkrup/meteor-now#user-content-full-deploy-with-mongodb
explains what probably is the reason for data loss. Please tell more about your MONGO_URL settings.
Are you sure that between the moment when you have your data and you lost your data you do not do deploy? In this architecture, any update of code will erase your database.
UPDATE 2
In my screenshots, there are errors connected with the incompatibility of meteor-now with now v2.
This is not connected with a database, but maybe partially. Now, v1 is service for Docker images, v2 is for lambda expressions. After downgrade
npm install -g now@1
Errors vanished, but I cant finish deploying It takes too much time. Below an example of connection with database from Mongo DB Atlas.
meteor-now -e MONGO_URL=mongodb+srv://<USER>:<PASSWORD>@<SUBDOMAIN>.mongodb.net/test?retryWrites=true
- 7,684
- 7
- 52
- 76
-
Maybe I'm misunderstanding your answer but to be clear I don't want to transfer any accounts I created on my local environment to the deployed application. The problem with the `meter-now` deployment is that if I register a new account I can login and logout, but after a while of not using the deployed app I cannot log back in with the new account I just registered and I have to register a new account again. I can even use the same email and password that was used. Shouldn't the deployed app keep track of all the new accounts that are created? – oxxi Jan 25 '19 at 17:37
-
I will register an account on meteor-now and will inspect problem more carefully. Time to vanishing user is always the same? Can you estimate this time? Other data are lost too? – Daniel Jan 25 '19 at 21:42
-
It's hard to tell how much time is needed for the user to vanish but it could be 30min to an hour. The only data that gets lost is the user that gets created. Everything else in the app is hardcoded. – oxxi Jan 25 '19 at 22:25
-
If you do not have mongo database you can create free (of course to some level of usage) instance on https://cloud.mongodb.com – Daniel Jan 25 '19 at 22:37
-
Ok I think the issue with the vanishing account is because I did not use a mongo url when deploying and so it uses the mongo database created from `meteor-now` and then probably after a while of not using the app the Zeit Now service deletes the temporary accounts created in the mongo database.Thanks for your help. – oxxi Jan 28 '19 at 19:51
