Login and template errors deploying meteor to Digital Ocean / modulus.io

74 views Asked by At

Apologies if this question is not asked correctly but I actually can't pinpoint the problem. Hence the lack of code in the question itself. I'm struggling with this error so please go easy on me....

I was developing a meteor app locally without too much difficulty. It seems to run well on localhost. But then I decided to deploy it and have been running into some problems as outlined below. I have deployed the app "successfully" using both mup/DO and modulus.io (with compose hosting the DB in both instances) and whole thing sort of works, but...

  1. You can register fine but when you try to log in the button doesn't work...press it again and you login but the usename and password are in the URL... how does this happen?

  2. When you login you can begin by creating a supplier, then create products for that supplier. Only thing is the suppliers are saved to the DB and they are in the product count but they are nowhere to be seen in the middle section page.

  3. Once you create a new supplier, the add new products for the existing suppliers is no longer accessible.

I am so confounded that I don't know what code to put up so I'm giving access to my codebase - it's on github here and this is the modulus site here. Go ahead and register and you can see for yourself.

You will easily be able to see the errors in the console when you start trying to log into the site so there is no point in posting them here.

Many, many thanks in advance guys.

1

There are 1 answers

1
Matthias A. Eckhart On BEST ANSWER

I have reviewed your code and I don't think that the errors occur due to the deployment.

Here's a list with a few suggestions that should help you to fix your code:

  1. In your /client/helpers/config.js file, you try to configure the behaviour of {{> loginButtons}}. That does not make any sense, since you do not have the accounts-ui package installed.
  2. The /client/templates/includes/header.html file references with pathFor to homepage. This route is currently not available in your /lib/router.js.
  3. Users are able to access the /loggedIn path even if they are not logged in. Furthermore, you always redirect users to this path if the submit form event in the register template occurs. This means, they can easily bypass the registration just by clicking on the submit button.
  4. Watch your console logs. There are a lot of template helper exceptions.
  5. Unfortunately, I could not check the login bug you described, because I received an exception when invoking the submit event. I recommend to use a rather defensive programming approach, you should at least check if the variable's value is not undefined and if it is, then you should handle those situations accordingly.

For example, in your /client/templates/includes/login.js file, you have the following code:

var userId = Meteor.userId();
var supplier = Suppliers.findOne({userId: userId});
var supplierId = supplier._id;

This will raise an exception if supplier is undefined.

All in all, you should rethink your release planning and deployment, since your app is far from working. Furthermore, please try to break your issue into chunks next time and provide a clear problem statement, because your question won't be useful to other readers without it.