javascriptmeteorvercelmeteor-useraccounts

Login Forbidden message after registering account


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.


Solution

  • 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.

    https://www.meteor-now.com/

    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

    How to connect mongodb clients to local Meteor MongoDB

    How do I use an existing MongoDB in a Meteor project?

    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

    Create a Meteor User in Fixtures with specific ID?

    UPDATE 1

    After installing Meteor Now I see these output without any additional configuration

    enter image description here

    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.

    https://github.com/jkrup/meteor-now/issues/133

    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