PecanProject / bety

Web-interface to the Biofuel Ecophysiological Traits and Yields Database (used by PEcAn and TERRA REF)
https://www.betydb.org
BSD 3-Clause "New" or "Revised" License
16 stars 38 forks source link

Error when adding a new user to BETYdb #355

Closed serbinsh closed 8 years ago

serbinsh commented 9 years ago

I keep having this issue when I add a user to BETY. I enter in all of the info and hit the sign up button, which then results in an error message (see attached)

screen shot 2015-10-01 at 1 17 00 pm

But if I check the users afterword the user is in the system and can log in (see testuser below)

screen shot 2015-10-01 at 1 17 21 pm

serbinsh commented 9 years ago

@dlebauer Have you seen this before? Is this an issue with our instance of BETY?

serbinsh commented 9 years ago

@robkooper or @mdietze Have you had this issue before? I searched the issues but didn't see anything like this posted yet.

robkooper commented 9 years ago

@serbinsh can you check in the log/production.log file?

gsrohde commented 9 years ago

@serbinsh Was this on betydb.org or some other deployment? If some other, what is the git version of the deployment? I didn't see anything suspicious in the betydb.org log files.

dlebauer commented 9 years ago

@serbinsh does this still occur?

dlebauer commented 8 years ago

@gsrohde this just occurred when I signed up for ebi-forecast.igb.illinois.edu/bety-mepp

gsrohde commented 8 years ago

Funny, I had no trouble.

dlebauer commented 8 years ago

Perhaps try signing up with a request for elevated permissions

On Mon, Nov 30, 2015 at 1:19 PM, Scott Rohde notifications@github.com wrote:

Funny, I had no trouble.

— Reply to this email directly or view it on GitHub https://github.com/PecanProject/bety/issues/355#issuecomment-160730567.

gsrohde commented 8 years ago

@dlebauer It looks like a new user was made in spite of the error message. And you must have gone in via psql and changed the access levels. Yes?

I did try with elevated permissions too and still had no problem.

gsrohde commented 8 years ago

I'll see if I can tell anything from the logs.

dlebauer commented 8 years ago

Yes, the user was successfully created

I did manually change access_leve

Here is the log:

args = []; block =
  Rendered users/new.html.erb within layouts/application (41.1ms)
Completed 200 OK in 58.2ms (Views: 57.2ms | ActiveRecord: 0.0ms)
Started POST "/bety-mepp/users" for 128.174.125.237 at 2015-11-30 12:53:18 -0600
Processing by UsersController#create as HTML
  Parameters: {"utf8"=>"✓", "authenticity_token"=>"hPjyEbBhnpRJ9i3WHIUjkWvZqCBKQO59CLZ/qyBMRBU=", "user"=>{"login"=>"dlebauer"
, "name"=>"David LeBauer", "email"=>"dlebauer@illinois.edu", "city"=>"Urbana", "state_prov"=>"Illinois", "country"=>"United St
ates", "postal_code"=>"61801", "area"=>"Researcher", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]", "page_ac
cess_level"=>"1", "access_level"=>"1"}, "access_level_reason"=>"I will be managing the site. I can change my access levels wit
hin psql", "recaptcha_challenge_field"=>"03AHJ_Vuu8H4zVYpngASz03K31-Db10kUECrDuA6NaBU3QFoz_DYMWUx7EvH6TzXxrud8jhxzh_XYljtMEcTj
IuEe4AzdoFkeVeOKXdNAxD-6orrBEuOvRS9Lltw730H1w3SwtLblGrTk-GhSarhxvNnXEVEOHaCYb84y3pM2zSZcz1DhA9iXD7iIL0qRQMdSsLMX02UIwnFMcCdnHG
VIkRAkkNr3ik6kn3Fww8rY2odbkHA5uxcvFenOPYbZIcK2798T81DsG4tcoauPQsYAUqBphp3FXne4Xew", "recaptcha_response_field"=>"298", "commit
"=>"Sign up"}
  Rendered contact_mailer/admin_approval.html.erb (1.3ms)

Sent mail to  (39.0ms)
Completed 500 Internal Server Error in 143.4ms

ArgumentError (An SMTP To address is required to send a message. Set the message smtp_envelope_to, to, cc, or bcc address.):
  app/controllers/users_controller.rb:56:in `create'
dlebauer commented 8 years ago

I think the issue may be that it tries to send a request for elevated permissions to the user with administrator privileges and there is no admin on a fresh install ...

On Mon, Nov 30, 2015 at 1:32 PM, Scott Rohde notifications@github.com wrote:

I'll see if I can tell anything from the logs.

— Reply to this email directly or view it on GitHub https://github.com/PecanProject/bety/issues/355#issuecomment-160734583.

gsrohde commented 8 years ago

Yes, that sound plausible, since I didn't have a problem after you had made an admin user.

serbinsh commented 8 years ago

@dlebauer @robkooper @gsrohde I apologize I missed the earlier questions. How do we resolve this?

dlebauer commented 8 years ago

This only occurs when there is no admin user. Could have a default admin user when installing a new instance, otherwise it is necessary to use psql to change user access. On Tue, Dec 1, 2015 at 8:51 AM Shawn P. Serbin notifications@github.com wrote:

@dlebauer https://github.com/dlebauer @robkooper https://github.com/robkooper @gsrohde https://github.com/gsrohde I apologize I missed the earlier questions. How do we resolve this?

— Reply to this email directly or view it on GitHub https://github.com/PecanProject/bety/issues/355#issuecomment-160989137.

serbinsh commented 8 years ago

Hmm...OK. But I am an admin and I still get the error every time I add a new user? Maybe I am misunderstanding?

dlebauer commented 8 years ago

Could you post the output from your production.log file? I was basing my suspicions on my error that failed to send an email with an empty to field On Tue, Dec 1, 2015 at 4:57 PM Shawn P. Serbin notifications@github.com wrote:

Hmm...OK. But I am an admin and I still get the error every time I add a new user? Maybe I am misunderstanding?

— Reply to this email directly or view it on GitHub https://github.com/PecanProject/bety/issues/355#issuecomment-161123813.

dlebauer commented 8 years ago

P.s. Compare to error log post above

serbinsh commented 8 years ago

@dlebauer

Here is my error:

[sserbin@modex log]$ tail production.log
  Parameters: {"utf8"=>"✓", "authenticity_token"=>"NfaZnTeyUubzkc4RMUSvDCBhJxNslsUE62uoR7U5V50=", "user"=>{"login"=>"test_user", "name"=>"test", "email"=>"test.becs.bnl@gmail.com", "city"=>"", "state_prov"=>"", "country"=>"", "postal_code"=>"", "area"=>"", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]", "page_access_level"=>"4", "access_level"=>"4"}, "access_level_reason"=>"", "recaptcha_challenge_field"=>"03AHJ_VuuhvtgahDjn7SpzjOf6Ffz9vjKO61g4D_qJAW6fK_VPQH5B0YJ66TfZdMFouuInM8SEulSPo8_Tu86gWobMaAXyUjWYjV0JO92lDLDgNkWJjxsYK-qtYNYRLY-OYvi-1dISBkPT93Uifh7dH3MHYiwjjfkOA24cSf77A7wFOk5ohcHWGOiJ1eZwFPgtAQ1SjJ60xExPt9wcUAPJGkxD4jFksbLFJx6kJDFxIQMEfr1SYqLsgHi7n04BuZ8ipY7Fy6V8da7QxY0-PxCphN3ez3J9n-0ozQ", "recaptcha_response_field"=>"1085", "commit"=>"Sign up"}
  Rendered contact_mailer/signup_email.html.erb (1.2ms)

Sent mail to devnull@ncsa.illinois.edu, tviskari@bnl.gov, sserbin@bnl.gov, test.becs.bnl@gmail.com (114.9ms)
Completed 500 Internal Server Error in 584.9ms

Errno::ECONNREFUSED (Connection refused - connect(2) for "localhost" port 25):
  app/controllers/users_controller.rb:58:in `create'

Does anyone know how BETYdb tries to send email? Does it use a default email app on the server?

serbinsh commented 8 years ago

Also, how do I get rid of attempting to email devnull@ncsa.illinois.edu? @robkooper @dlebauer

gsrohde commented 8 years ago

@serbinsh Do the query

SELECT email FROM users WHERE page_access_level = 1;

on your BETY database. The mail should get sent to these address plus the address of the person signing up.

BETYdb uses a Ruby library called ActionMailer. I haven't worked with it a lot myself, but there is documentation here: http://guides.rubyonrails.org/v3.2/action_mailer_basics.html Section 5 deals with configuration settings. There are two files in BETYdb (config/additional_environment_ebi.rb and config/additional_environment_vm.rb) that set some configuration parameters, but I don't think they actually get used--I think we just use the default values for the settings. But it's possible these don't work on your server. If your server has mail-sending capability, then there is probably some set of settings that would work. Or if you don't care about sending out e-mails, you can probably turn them off. If you have a file called config/additional_environment.rb, it will automatically get included (by line 60 of config/application.rb) and used.

gsrohde commented 8 years ago

Pull request #378 will fix this.

gsrohde commented 8 years ago

Fixed in release 4.5.