Mail: Settings auto-detect fails with "Error while creating the account: Internal Server Error"

Created on 1 Nov 2017  路  10Comments  路  Source: nextcloud/mail

Steps to reproduce

Add a new Gmail account without using manual configuration.

Expected behaviour

Gmail connection settings (imap.gmail.com/993/SSL and smtp.gmail.com/465/SSL) should be auto-detected and account created.

Actual behaviour

Fails with Error while creating the account: Internal Server Error: account is not created.
When checking server log, the following error message appears Error: Call to undefined function OCA\Mail\Service\AutoConfig\no_null(), along with a stack trace (see below).

Mail app

Mail app version: 0.7.4
Mailserver or service: Gmail
Transport security - IMAP: SSL
Transport security - SMTP: SSL
Number of accounts: 1

Server configuration

Operating system: Debian 9 (Stretch)
Web server: nginx/1.10.3 (fpm-fcgi)
Database: mysql 10.1.26-MariaDB
PHP version: 7.0.19-1
Nextcloud version: 12.0.3 - 12.0.3.3
Updated from an older version or fresh install: Fresh install

Server log (data/nextcloud.log)

Error: Call to undefined function OCA\Mail\Service\AutoConfig\no_null()
0. /var/www/files/<REDACTED>/cloud/apps/mail/lib/Service/AutoConfig/IspDbConfigurationDetector.php - line 93: OCA\Mail\Service\AutoConfig\IspDbConfigurationDetector->detectImap(Array, '<REDACTED>@gmail.co...', '<REDACTED>', '<REDACTED>')
1. /var/www/files/<REDACTED>/cloud/apps/mail/lib/Service/AutoConfig/AutoConfig.php - line 51: OCA\Mail\Service\AutoConfig\IspDbConfigurationDetector->detectImapAndSmtp('<REDACTED>@gmail.co...', '<REDACTED>', '<REDACTED>')
2. /var/www/files/<REDACTED>/cloud/apps/mail/lib/Service/SetupService.php - line 72: OCA\Mail\Service\AutoConfig\AutoConfig->createAutoDetected('<REDACTED>@gmail.co...', '<REDACTED>', '<REDACTED>')
3. /var/www/files/<REDACTED>/cloud/apps/mail/lib/Controller/AccountsController.php - line 182: OCA\Mail\Service\SetupService->createNewAutoConfiguredAccount('<REDACTED>', '<REDACTED>@gmail.co...', '<REDACTED>')
4. [internal function] OCA\Mail\Controller\AccountsController->create('<REDACTED>', '<REDACTED>@gmail.co...', '<REDACTED>', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, true)
5. /var/www/files/<REDACTED>/cloud/lib/private/AppFramework/Http/Dispatcher.php - line 160: call_user_func_array(Array, Array)
6. /var/www/files/<REDACTED>/cloud/lib/private/AppFramework/Http/Dispatcher.php - line 90: OC\AppFramework\Http\Dispatcher->executeController(Object(OCA\Mail\Controller\AccountsController), 'create')
7. /var/www/files/<REDACTED>/cloud/lib/private/AppFramework/App.php - line 114: OC\AppFramework\Http\Dispatcher->dispatch(Object(OCA\Mail\Controller\AccountsController), 'create')
8. /var/www/files/<REDACTED>/cloud/lib/private/AppFramework/Routing/RouteActionHandler.php - line 47: OC\AppFramework\App main('OCA\\Mail\\Contro...', 'create', Object(OC\AppFramework\DependencyInjection\DIContainer), Array)
9. [internal function] OC\AppFramework\Routing\RouteActionHandler->__invoke(Array)
10. /var/www/files/<REDACTED>/cloud/lib/private/Route/Router.php - line 299: call_user_func(Object(OC\AppFramework\Routing\RouteActionHandler), Array)
11. /var/www/files/<REDACTED>/cloud/lib/base.php - line 1004: OC\Route\Router->match('/apps/mail/api/...')
12. /var/www/files/<REDACTED>/cloud/index.php - line 48: OC handleRequest()
13. {main}

3. to review bug

All 10 comments

And indeed, if we look at line 123 in IspDbConfigurationDetector, we see that a function no_null is called, even though it doesn't seem to be defined anywhere.

Is that a missing dependency on my end?

Whoops, that's a typo. Obviously that should be not_null. Wanna fix this and submit a pull request? That would be great 馃槈

I'd be happy to submit a pull request, but unfortunately, it seems it is not a simple matter of fixing the no_null call.

After trying with if (!is_null($account)) instead of the current if (!no_null($account)), Gmail auto-config is still not working.

Though this time, there are no errors in the Nextcloud log, it seems the account is not properly created, because the following error appears in JS console: could not create account: TypeError: firstAccount is undefined

This seems to happen at line 101 in setupview.js because accounts is empty.

Since I am not familiar with Nextcloud debugging, I can't really go any further... :/

No worries, I'll look into this.

I'm having the same issue, thanks for working on it!

Obviously that should be not_null

Haha, obviously this should be is_null. not_null doesn't exist either 馃檲

Huh. I must admit I don't understand: I had tried with if (!is_null($account)) as explained in my previous comment, and it still wasn't working.

Yup, because there was another bug: #625

Nice! Thanks for the fix.

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and questions.

Was this page helpful?
0 / 5 - 0 ratings