Server: Error while creating a new user with an email address

Created on 23 Nov 2018  ·  10Comments  ·  Source: nextcloud/server

When I try to create a new user (master aka Nextcloud 15) with an email address I get this error in the browser: "An error occured during the request. Unable to proceed. Bad request"

That's the error in the JS console of the browser:

Object { users: Getter & Setter, apps: Getter & Setter, settings: Getter & Setter, oc: Getter & Setter, route: Getter & Setter, … } {…}​error: Error: "Request failed with status code 400" exports http://localhost:70/server/settings/js/settings-vue.js:7:80380 exports http://localhost:70/server/settings/js/settings-vue.js:14:1311 h http://localhost:70/server/settings/js/settings-vue.js:7:79394 ​userid: "user4"​<prototype>: {…}​​__defineGetter__: function __defineGetter__()​​__defineSetter__: function __defineSetter__()​​__lookupGetter__: function __lookupGetter__()​​__lookupSetter__: function __lookupSetter__()​​constructor: function Object()​​hasOwnProperty: function hasOwnProperty()​​isPrototypeOf: function isPrototypeOf()​​propertyIsEnumerable: function propertyIsEnumerable()​​toLocaleString: function toLocaleString()​​toSource: function toSource()​​toString: function toString()​​valueOf: function valueOf() index.js:43:2

and that's the error I get in the nextcloud.log:

{"reqId":"lRovXaxQpVDxS90hpA91","level":3,"time":"2018-11-23T10:36:48+00:00","remoteAddr":"172.17.0.1","user":"admin","app":"ocs_api","method":"POST","url":"\/server\/ocs\/v2.php\/cloud\/users","message":{"Exception":"Swift_TransportException","Message":"Connection could not be established with host 127.0.0.1 [Connection refused #111]","Code":0,"Trace":[{"file":"\/var\/www\/html\/server\/3rdparty\/swiftmailer\/swiftmailer\/lib\/classes\/Swift\/Transport\/StreamBuffer.php","line":58,"function":"establishSocketConnection","class":"Swift_Transport_StreamBuffer","type":"->","args":[]},{"file":"\/var\/www\/html\/server\/3rdparty\/swiftmailer\/swiftmailer\/lib\/classes\/Swift\/Transport\/AbstractSmtpTransport.php","line":143,"function":"initialize","class":"Swift_Transport_StreamBuffer","type":"->","args":[{"protocol":"","host":"127.0.0.1","port":25,"timeout":10,"blocking":1,"tls":false,"type":1,"stream_context_options":[]}]},{"file":"\/var\/www\/html\/server\/3rdparty\/swiftmailer\/swiftmailer\/lib\/classes\/Swift\/Mailer.php","line":65,"function":"start","class":"Swift_Transport_AbstractSmtpTransport","type":"->","args":[]},{"file":"\/var\/www\/html\/server\/lib\/private\/Mail\/Mailer.php","line":180,"function":"send","class":"Swift_Mailer","type":"->","args":[{"__class__":"Swift_Message"},[]]},{"file":"\/var\/www\/html\/server\/settings\/Mailer\/NewUserMailHelper.php","line":169,"function":"send","class":"OC\\Mail\\Mailer","type":"->","args":[{"__class__":"OC\\Mail\\Message"}]},{"file":"\/var\/www\/html\/server\/apps\/provisioning_api\/lib\/Controller\/UsersController.php","line":307,"function":"sendMail","class":"OC\\Settings\\Mailer\\NewUserMailHelper","type":"->","args":[{"__class__":"OC\\User\\User"},{"__class__":"OC\\Mail\\EMailTemplate"}]},{"file":"\/var\/www\/html\/server\/lib\/private\/AppFramework\/Http\/Dispatcher.php","line":166,"function":"addUser","class":"OCA\\Provisioning_API\\Controller\\UsersController","type":"->","args":["user4","hfhfkjshd","","[email protected]",[],[],"default","en"]},{"file":"\/var\/www\/html\/server\/lib\/private\/AppFramework\/Http\/Dispatcher.php","line":99,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\Provisioning_API\\Controller\\UsersController"},"addUser"]},{"file":"\/var\/www\/html\/server\/lib\/private\/AppFramework\/App.php","line":118,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\Provisioning_API\\Controller\\UsersController"},"addUser"]},{"file":"\/var\/www\/html\/server\/lib\/private\/AppFramework\/Routing\/RouteActionHandler.php","line":47,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Provisioning_API\\Controller\\UsersController","addUser",{"__class__":"OC\\AppFramework\\DependencyInjection\\DIContainer"},{"_route":"ocs.provisioning_api.Users.addUser"}]},{"function":"__invoke","class":"OC\\AppFramework\\Routing\\RouteActionHandler","type":"->","args":[{"_route":"ocs.provisioning_api.Users.addUser"}]},{"file":"\/var\/www\/html\/server\/lib\/private\/Route\/Router.php","line":297,"function":"call_user_func","args":[{"__class__":"OC\\AppFramework\\Routing\\RouteActionHandler"},{"_route":"ocs.provisioning_api.Users.addUser"}]},{"file":"\/var\/www\/html\/server\/ocs\/v1.php","line":82,"function":"match","class":"OC\\Route\\Router","type":"->","args":["\/ocsapp\/cloud\/users"]},{"file":"\/var\/www\/html\/server\/ocs\/v2.php","line":24,"args":["\/var\/www\/html\/server\/ocs\/v1.php"],"function":"require_once"}],"File":"\/var\/www\/html\/server\/3rdparty\/swiftmailer\/swiftmailer\/lib\/classes\/Swift\/Transport\/StreamBuffer.php","Line":269,"CustomMessage":"Can't send new user mail to [email protected]"},"userAgent":"Mozilla\/5.0 (X11; Linux x86_64; rv:63.0) Gecko\/20100101 Firefox\/63.0","version":"15.0.0.7"} {"reqId":"lRovXaxQpVDxS90hpA91","level":3,"time":"2018-11-23T10:36:48+00:00","remoteAddr":"172.17.0.1","user":"admin","app":"ocs_api","method":"POST","url":"\/server\/ocs\/v2.php\/cloud\/users","message":{"Exception":"OCP\\AppFramework\\OCS\\OCSException","Message":"Unable to send the invitation mail","Code":109,"Trace":[{"file":"\/var\/www\/html\/server\/lib\/private\/AppFramework\/Http\/Dispatcher.php","line":166,"function":"addUser","class":"OCA\\Provisioning_API\\Controller\\UsersController","type":"->","args":["user4","hfhfkjshd","","[email protected]",[],[],"default","en"]},{"file":"\/var\/www\/html\/server\/lib\/private\/AppFramework\/Http\/Dispatcher.php","line":99,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\Provisioning_API\\Controller\\UsersController"},"addUser"]},{"file":"\/var\/www\/html\/server\/lib\/private\/AppFramework\/App.php","line":118,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\Provisioning_API\\Controller\\UsersController"},"addUser"]},{"file":"\/var\/www\/html\/server\/lib\/private\/AppFramework\/Routing\/RouteActionHandler.php","line":47,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Provisioning_API\\Controller\\UsersController","addUser",{"__class__":"OC\\AppFramework\\DependencyInjection\\DIContainer"},{"_route":"ocs.provisioning_api.Users.addUser"}]},{"function":"__invoke","class":"OC\\AppFramework\\Routing\\RouteActionHandler","type":"->","args":[{"_route":"ocs.provisioning_api.Users.addUser"}]},{"file":"\/var\/www\/html\/server\/lib\/private\/Route\/Router.php","line":297,"function":"call_user_func","args":[{"__class__":"OC\\AppFramework\\Routing\\RouteActionHandler"},{"_route":"ocs.provisioning_api.Users.addUser"}]},{"file":"\/var\/www\/html\/server\/ocs\/v1.php","line":82,"function":"match","class":"OC\\Route\\Router","type":"->","args":["\/ocsapp\/cloud\/users"]},{"file":"\/var\/www\/html\/server\/ocs\/v2.php","line":24,"args":["\/var\/www\/html\/server\/ocs\/v1.php"],"function":"require_once"}],"File":"\/var\/www\/html\/server\/apps\/provisioning_api\/lib\/Controller\/UsersController.php","Line":314,"CustomMessage":"Failed addUser attempt with exception."},"userAgent":"Mozilla\/5.0 (X11; Linux x86_64; rv:63.0) Gecko\/20100101 Firefox\/63.0","version":"15.0.0.7"}
The mailer error makes me wonder if we try to send a welcome mail to the new user, although mail is not configured on my test server? Maybe a test if the mail server is configured is missing?

3. to review bug users and groups

Most helpful comment

@skjnldsv no, that's only handle the notification mail about new shares. We probably need something similar at the code where we send the invitation mail.

All 10 comments

GitMate.io thinks possibly related issues are https://github.com/nextcloud/server/issues/1011 (Error while re-creating a user), https://github.com/nextcloud/server/issues/12597 (Error when sharing to user with email), https://github.com/nextcloud/server/issues/8377 (Missing email field when admin create/add new user), https://github.com/nextcloud/server/issues/5746 (Create user failed / password policy crash), and https://github.com/nextcloud/server/issues/5751 (Errors when creating groups from the user list.).

cc @skjnldsv

Unable to send the invitation mail
You need to have an email setup.
@MorrisJobke we had this talk last week iirc? I don't remember, there was a fix or an opened issue abou tthis?

@skjnldsv no, that's only handle the notification mail about new shares. We probably need something similar at the code where we send the invitation mail.

Okay, I thought you were fixing it more deeply :)

what's the status of this bug? it's clear a bug due we can setup NC only as share directory and not complete notification system!!!

@mckaygerhard I don't understand your message

@skjnldsv i must be able to install NC and setup users without use emails... only as shared intranet file server!

currently that it's not possible due this BUG! #12622

Nextcloud tries to send an invitation email if you add a new user and an email address is set. Just skip the email address for now.

https://github.com/nextcloud/server/blob/98244b5d6dea7304cfa431d3f391836609fd0ae4/apps/provisioning_api/lib/Controller/UsersController.php#L325-L338

This issue is about the case that you are adding a user and set an email address without proper smtp/sendmail configuration.

Was this page helpful?
0 / 5 - 0 ratings