Open mhl opened 10 years ago
We recently encountered this situation, where the InfoRequestEvent didn't get created, when a user created a new request.
For some reason, that I've still not been able to determine, Alaveteli thought the address was incorrect and threw an exception before the InfoRequestEvent was created. Here's the details of that issue:
A RuntimeError occurred in request#new:
invalid email foi@ipaustralia.gov.au passed to address_from_name_and_email
lib/mail_handler/backends/mail_backend.rb:358:in `address_from_name_and_email'
Relevant backtrace:
lib/mail_handler/backends/mail_backend.rb:358:in `address_from_name_and_email'
app/models/info_request.rb:758:in `recipient_name_and_email'
app/mailers/outgoing_mailer.rb:23:in `initial_request'
actionpack (3.1.12) lib/abstract_controller/base.rb:167:in `send_action'
actionpack (3.1.12) lib/abstract_controller/base.rb:167:in `process_action'
actionpack (3.1.12) lib/abstract_controller/base.rb:121:in `process'
actionpack (3.1.12) lib/abstract_controller/rendering.rb:45:in `process'
actionmailer (3.1.12) lib/action_mailer/old_api.rb:65:in `process'
actionmailer (3.1.12) lib/action_mailer/base.rb:474:in `process'
actionmailer (3.1.12) lib/action_mailer/base.rb:469:in `initialize'
actionmailer (3.1.12) lib/action_mailer/base.rb:456:in `new'
actionmailer (3.1.12) lib/action_mailer/base.rb:456:in `method_missing'
app/models/outgoing_message.rb:155:in `send_message'
app/controllers/request_controller.rb:352:in `new'
Similar to @mhl above, I manually created the InfoRequestEvent but used the Rails console instead. This allowed me to see the request page and resend the message using the admin backend.
I think the problem with the address may be a leading space. If so, the immediate action here may be to figure out why it wasn't stripped.
I couldn't see a problem in the admin UI and we'd sent requests to this address before.
Also, the first thing I did was fire up a Rails console and manually run that function and it worked fine.
I'd have a quick check in the db to see if there's a leading space (from the error message you pasted, it looks like there is). Previous versions of Alaveteli would have considered an email address with a leading space as OK, so it might have been fine previously if you were running an Alaveteli version before 0.12 at the time.
Ah that could have been it. It's all working now so I can't go back and check [easily].
Just noting some documentation for manually resending messages that get this error https://github.com/mysociety/alaveteli/wiki/Resending-Failed-Outgoing-Messages
The following situation happened to me:
prominence
column not existing, indicating that I'd forgotten to runbundle exec rake db:migrate
after moving to newer code.From this point on, lots of requests fail with errors like:
The problem here seemed to be that the InfoRequest and OutgoingMessage had been created successfully, but creating the InfoRequestEvent had failed. This could be fixed up manually with:
However, to avoid people getting into this situation it would be best if the creation of these objects all happened in the same transaction.